locked
Base Model. How could I do this? RRS feed

  • Question

  • User1608082067 posted

    Hello,

    I have a BaseModel defined as follows:

      public class BaseModel {
    
        public GoogleAnalytics Analytics { get; set; }
        public PageHead Head { get; set; }
    
        public ViewModel Model { get; set; }
    
      } // BaseModel


    I am defining this model on BaseController. All controller inherit BaseController.

    Then on each action I would like to define the ViewModel Model.

    Like in one view Model would be ArticleCreate. On another Model would be DocumentEdit, etc.

    Is is possible to create an ArticleCreate, DocumentEdit, models and "make" Model that?

    Or maybe some kind fo model factory ... I am not sure.

    Basically, I would like to have a BaseModel with a ViewModel that could be anything.

    Thanks,

    Miguel

    Thursday, December 10, 2009 2:56 PM

Answers

  • User-2115483147 posted

    Can you post more code here?

     

    The class of  BaseModel is not inherit the class Controller, so I think we can not use this BaseModel as the BaseController,

    public abstract class Controller : ControllerBase, IActionFilter, IAuthorizationFilter, IDisposable, IExceptionFilter, IResultFilter

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 16, 2009 4:57 AM