public JsonResult Login(Models.LoginModel model) { if (model.Account == "root" && !string.IsNullOrEmpty(model.Hash)) { return(Json(DealResult.Location(Url.Location(Index)))); } else { return(Json(DealResult.Wrong("帐号或密码错误"))); } }
public JsonResult Create(Models.DataTableItemModel model) { if (ModelState.ValidateFail()) { return(Json(DealResult.Wrong(ModelState.ValidateMessage()))); } var data = new Models.DataTableItemModel(); model.MapTo(data); data.Id = GetDataSource().Max(o => o.Id) + 1; model.DealUpload((file) => { data.File = FileLocation.Create(file.FileName, file.ContentType, ""); }, o => o.File); data.Files = new List <HttpPostedFileBase>(); model.DealUpload((file) => { data.Files.Add(FileLocation.Create(file.FileName, file.ContentType, "")); }, o => o.Files); GetDataSource().Insert(0, data); return(Json(DealResult.Location(Url.Location(Index), "添加成功"))); }
public JsonResult Login(string account, string hash) { if (!(TempData["HashSeed"] is string hashSeed)) { return(Json(DealResult.Wrong("脚本运行不正确"))); } if (account == "test") { var claims = new List <System.Security.Claims.Claim>() { new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Name, "test"), new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.NameIdentifier, Guid.Empty.ToString("N")), new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Role, "Test"), }; var identity = new System.Security.Claims.ClaimsIdentity(claims, "ApplicationCookie"); HttpContext.SignInAsync(new System.Security.Claims.ClaimsPrincipal(new[] { identity })); return(Json(DealResult.Location(Url.Location <HomeController>(o => o.Index)))); } else { return(Json(DealResult.Wrong("帐号或密码错误"))); } }
public JsonResult MoreLevelResult(Models.MoreLevelModel model) { LevelModel = model; return(Json(DealResult.Location(Url.Location(Male)))); }