public ActionResult SetHours(int id) { TaskRepo repo = new TaskRepo(); Task task = repo.GetById(id); SetHoursVM set = new SetHoursVM(); set.SetHours = 0; set.Id = task.Id; if (task.assignetId == AuthenticationManager.LoggedUser.Id || task.creatorId == AuthenticationManager.LoggedUser.Id) { return(View(set)); } else { return(RedirectToAction("Index", "TaskManagement")); } }
public ActionResult SetHours(SetHoursVM set) { TaskRepo repo = new TaskRepo(); Task task = repo.GetById(set.Id); task.editedBY = AuthenticationManager.LoggedUser.Id; task.editedON = DateTime.Now; task.estimate = task.estimate + set.SetHours; repo.Edit(task); LogWorkRepo repoWork = new LogWorkRepo(); LogWork work = new LogWork(); work.TaskId = task.Id; work.Username = AuthenticationManager.LoggedUser.Username; work.Email = AuthenticationManager.LoggedUser.Email; work.Time = set.SetHours; work.Date = DateTime.Now; repoWork.Create(work); return(RedirectToAction("CreateComment", "CommentManagement", new { id = task.Id })); }