Ejemplo n.º 1
0
 public ActionResult NewAccount(RegisterModel model)
 {
     // Redirect if the user isn't an admin
     if (!IdentityModel.CurrentUserAdmin)
     {
         return(RedirectToAction("Index", "Home"));
     }
     // If model isn't valid return with error messages, otherwise add the user return error or success based on the AddAccount() return
     return(ModelState.IsValid ? View(model.AddAccount() ? "Success" : "Error") : View());
 }