Ejemplo n.º 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"));
            }
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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()));
 }
Ejemplo n.º 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));
        }