// POST: Task/Delete/5 public ActionResult Delete(int id, TaskViewModel TVM) { if (!Request.IsAuthenticated) { return(RedirectToAction("Login", "Account")); } //redirect to nowhere if not admin if (!(User.IsInRole("Team Leader"))) { return(RedirectToAction("Nowhere", "Account")); } Tasks T = TS.GetById(id); TVM.TasksId = T.TasksId; TVM.TaskName = T.TaskName; TVM.Start_Date = T.Start_Date; TVM.End_Date = T.End_Date; TVM.Duration = T.Duration; TVM.Description = T.Description; TVM.Estimation = T.Estimation; TS.Delete(T); TS.Commit(); return(RedirectToAction("Details", "Project", new { id = T.ProjectFK })); }
public ActionResult Delete(Guid taskId) { try { return(Ok(_taskServices.Delete(taskId))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult Delete(int id, TaskViewModel TVM) { Tasks T = TS.GetById(id); TVM.TasksId = T.TasksId; TVM.TaskName = T.TaskName; TVM.Start_Date = T.Start_Date; TVM.End_Date = T.End_Date; TVM.Duration = T.Duration; TVM.Description = T.Description; TVM.Estimation = T.Estimation; TS.Delete(T); TS.Commit(); return(RedirectToAction("Index")); }