Exemple #1
0
 public static TaskUserEntity ToBLL(TaskUserModel taskUser)
 {
     return new TaskUserEntity
     {
         UserId = taskUser.UserId,
         TaskId = taskUser.TaskId,
         Progress = taskUser.Progress,
     };
 }
        public ActionResult EditProgress(TaskUserModel task, bool unused = false)
        {
            ActionResult result = View(task);
            if (ModelState.IsValid)
            {
                if (task.Progress <= 100 && task.Progress >= 0)
                {
                    UserEntity user = userService.Find(x => x.Login == User.Identity.Name);
                    TaskUserEntity tue = taskUserService.Find(x => x.TaskId == task.TaskId && x.UserId == user.Id);
                    tue.Progress = task.Progress;
                    taskUserService.Edit(tue);
                    result = RedirectToAction("Index", "Home", new { message = "Progress of task " + task.TaskTitle + " updated" });
                }
                else
                {
                    ModelState.AddModelError("", "Progress must be integer in range [0,100]");
                }
            }

            return result;
        }
 public ActionResult EditProgress(TaskUserModel task)
 {
     return View(task);
 }