Exemplo n.º 1
0
        public ActionResult Edit(UserTaskViewModel userTask)
        {
            if (ModelState.IsValid)
            {
                var userTaskResult = MapperGetUserTasks(userTask);
                userTaskService.Edit(userTaskResult);

                return(RedirectToAction("Index"));
            }
            return(View(userTask));
        }
Exemplo n.º 2
0
        public ActionResult Edit(ExtentionTaskViewModel model)
        {
            if (ModelState.IsValid)
            {
                UserTask userTask = new UserTask
                {
                    ID      = model.ID,
                    TaskID  = (int)model.TaskID,
                    UserID  = (int)model.UserID,
                    Answer  = model.Answer,
                    Comment = model.Comment,
                    Grade   = model.Grade
                };

                userTaskService.Edit(userTask);
                return(RedirectToAction("Index", "Profile"));
            }
            ViewBag.SectionID = new SelectList(sectionService.GetAll(), "ID", "Description", model.Section.ID);
            if (model.Grade != null)
            {
                ViewBag.Grade = new SelectList(new List <string>()
                {
                    "Отлично",
                    "Хорошо",
                    "Удовлетворительно",
                    "Неудовлетворительно"
                }, "ID", "Description", model.Grade);
            }
            else
            {
                ViewBag.Grade = new SelectList(new List <string>()
                {
                    "Отлично",
                    "Хорошо",
                    "Удовлетворительно",
                    "Неудовлетворительно"
                }, "ID");
            }
            return(View(model));
        }