public IActionResult Detail(Userrelation relation) { User user = new User { relation = relatonService.ShowDetail(relation.Uid), detail = userService.ShowDetail(relation.Uid), }; var projects = projectService.GetAll(); ViewData["projects"] = projects; return(View(user)); }
public IActionResult Login(Userdetail tologin) { if (tologin == null) { errorMsg = "用户名或密码不能为空"; return(Redirect(Url.Action("Index", "Home"))); } var model = userService.ShowDetail(tologin.Uid); if (model == null || model.Passwod != tologin.Passwod) { //ViewData["errorMsg"] = "showErrorMsg(\'用户名或密码错误!\');"; errorMsg = "用户名或密码错误"; return(Redirect(Url.Action("Index", "Home"))); } model.Passwod = null; UserrelationService relationService = new UserrelationService(); var relation = relationService.ShowDetail(tologin.Uid); var user = new User() { detail = model, relation = relation }; string json = JsonConvert.SerializeObject(user); this.Response.Cookies.Append("user", json); return(Redirect(Url.Action("Privacy", "Home"))); }
//更新 public IActionResult Update(Userdetail detail) { if (userService.ShowDetail(detail.Uid).Uname != detail.Uname) { var relatonService = new UserrelationService(); var relation = relatonService.ShowDetail(detail.Uid); relation.Name = detail.Uname; relatonService.Update(relation); } var id = userService.Update(detail); return(Redirect(Url.Action("Detail", "_User") + $"?uid={id}")); }
public IActionResult Create(ForCase forCase) { int count = 0; var casedetail = new Casedetail() { Uid = forCase.Uid2, ModifyDate = DateTime.Now, Prior = forCase.Prior, Detail = forCase.Detail, Previous = forCase.Previous, }; var cid = detailservice.Create(casedetail); if (cid > 0) { var json = HttpContext.Request.Cookies["user"]; User loginuser = JsonConvert.DeserializeObject <User>(json); var thecase = new Thecase() { Cid = cid, Uid = loginuser.detail.Uid, Pid = forCase.Pid, Unid = forCase.Unid, Proid = loginuser.relation.Proid, Ctitle = forCase.Ctitle, Name = loginuser.detail.Uname, State = "enable", Toname = relationService.ShowDetail(forCase.Uid2).Name, }; count = caseService.Create(thecase); if (count == 0) { detailservice.Del(cid); } } return(Redirect(Url.Action("Index", "_Case"))); //else }