Пример #1
0
        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"));
            }
        }
Пример #2
0
        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));
        }
Пример #3
0
 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()));
 }
Пример #4
0
        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));
        }