Developing ASP.NET MVC 4 Web Applications: (03) Developing MVC 4 Controllers

Sign in to queue

The Discussion

  • User profile image
    BrunoLM

    [HttpGet] is not the default. Because you can make HEAD requests. If you set it to [HttpGet], Facebook like button and these stuff will probably stop working. I had this issue in a code I got once, had to remove this useless code.

  • User profile image
    10percent

    @BrunoLM: I tend to use HttpGet for Index actions that do the initial page load. Actions that are only valid for AJAX posts I use HttpPost. These attributes are worth the effort and prevent actions being called in the wrong way.

  • User profile image
    10percent

    This ViewModel pattern mention would have been better in the video on Models rather than EF, but really glad Jon finally mentions it.

    To avoid confusion I normally call lower level models "entities" or "data entities" and reserve the word model for higher level / complex objects that really are models. I tend to avoid the use of the word ViewModel since it always reminds me of MVVM as Jon says, but that is also because often loading logic into the action rather than the model can be simpler.

  • User profile image
    Syed Rizwan ul Hassan

    t to know about the best possible technique for MVC RAZOR, either we have to choose or it has empty project or template

Add Your 2 Cents