public IActionResult EditSolution(int ID) { string username = HttpContext.Session.GetString("username"); if (username != null) { Solution solution = db.Solutions.SingleOrDefault(m => m.ID == ID); List <string> SolutionType = new List <string>(); List <SolutionType> solutionType = db.SolutionTypes.ToList(); foreach (var item in solutionType) { SolutionType.Add(item.Type); } EditSolutionModel editSolutionModel = new EditSolutionModel { Solution = solution, SolutionType = SolutionType }; ViewBag.username = username; return(View(editSolutionModel)); } else { ViewBag.tips = "您还没有登录,请先登录"; return(View("Login")); } }
public IActionResult EditSolution(Guid id) { var solution = _solutionService.FindById(id); if (null == solution) { return(NotFound()); } EditSolutionModel model = new EditSolutionModel(); solution.CopyTo(model); return(View($"~/Areas/{WebContext.Area}/Views/Solution/{WebContext.ActionName}.cshtml", model)); }
public IActionResult EditSolution(EditSolutionModel model) { if (ModelState.IsValid) { var entity = _solutionService.FindById(model.SolutionId); model.CopyTo(entity); entity.ModifiedOn = DateTime.Now; entity.ModifiedBy = CurrentUser.SystemUserId; _solutionService.Update(entity); return(UpdateSuccess()); } return(UpdateFailure(GetModelErrors())); }
public IActionResult EditSolution(Guid id) { var solution = _solutionService.FindById(id); if (null == solution) { return(NotFound()); } EditSolutionModel model = new EditSolutionModel(); solution.CopyTo(model); return(View(model)); }