public ActionResult Index(UserModel model) { if (!UserValidator.UserEmptyLoginValidate(model, this.ModelState)) return PartialView("_LoginPartial"); Session["UserName"] = model.UserName; return Json(new {success = true}); }
public static bool UserEmptyLoginValidate(UserModel model, ModelStateDictionary modelState) { if (model.UserName == null || model.Password == null) return false; if (model.UserName != "aaa") { modelState.AddModelError("UserName", "Неправильное имя пользователя или пароль"); return false; } return true; }
public ActionResult Index(UserModel model) { return View(); }
public JsonResult Login(UserModel model) { var categoryList = new JsonResult(); return Json(categoryList, JsonRequestBehavior.AllowGet); }