From Microsoft's own built in template for MVC3

The model is extremely skinny, having basically no code.


public class RegisterModel
    [Display(Name = "User name")]
    public string UserName { get; set; }

    [Display(Name = "Email address")]
    public string Email { get; set; }

    [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
    [Display(Name = "Password")]
    public string Password { get; set; }

    [Display(Name = "Confirm password")]
    [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
    public string ConfirmPassword { get; set; }

While the Controller on the other hand seems to be fat, doing more that simple routing...


public ActionResult Register(RegisterModel model)
    if (ModelState.IsValid)
        // Attempt to register the user
        MembershipCreateStatus createStatus;
        Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus);

        if (createStatus == MembershipCreateStatus.Success)
            FormsAuthentication.SetAuthCookie(model.UserName, false /* createPersistentCookie */);
            return RedirectToAction("Index", "Home");
            ModelState.AddModelError("", ErrorCodeToString(createStatus));

    // If we got this far, something failed, redisplay form
    return View(model);
  • The controller seems skinny enough. As to the model it is a matter of style what you make of them. In this case they are rather data entities which is a perfectly fine approach.
    – user8685
    Commented Jun 1, 2011 at 19:33
  • 2
    Controller is going to hold the instance to the Model and the View but it does not appear as "fat" as you say. Commented Jun 1, 2011 at 19:58
  • Agreed--perhaps it's a bit more verbose than, say, Rails, but that is largely a byproduct of the language, not the framework. A typical (again, let's say) Rails controller would have very similar code in it. Commented Jun 2, 2011 at 5:01

2 Answers 2


Everything the controller is doing there is its job, its pretty basic stuff. Business logic is not going to be generated for you. Models get fat when you encapsulate useful functionality into them; you can't expect to see that from a template.


I'm curious how you think the controller could be put on a diet? I honestly can't see anything there that could move to the model without violating SRP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.