public ActionResult AddSub(SubToDo st, DetailsToDoModel DTModel) { SubToDoHelper h = new SubToDoHelper(new Repository()); if (ModelState.IsValid) { h.AddSubToDo(st, DTModel.TID); return(RedirectToAction("Details", "ToDo", new { id = DTModel.TID })); } else { return(View(DTModel)); } }
public ActionResult DeleteST(int id, int tid) { SubToDoHelper h = new SubToDoHelper(new Repository()); try { h.DeleteSubToDo(id); return(RedirectToAction("Details", "ToDo", new { id = tid })); } catch { return(RedirectToAction("Details", "ToDo", new { id = tid })); } }
public ActionResult Edit(int id) { SubToDoHelper h = new SubToDoHelper(new Repository()); SubToDo t = h.GetSubToDo(id); sToDoModel stm = new sToDoModel { Name = t.Name, Description = t.Description, State = t.State, TID = t.ToDo.ID }; DropDownInit(t.State); return(View(stm)); }
public ActionResult Edit(int id, sToDoModel stm) { SubToDoHelper h = new SubToDoHelper(new Repository()); var st = h.GetSubToDo(id); st.Name = stm.Name; st.State = stm.State; st.Description = stm.Description; DropDownInit(st.State); if (ModelState.IsValid) { SubToDoHelper Helper = new SubToDoHelper(new Repository()); Helper.EditSubToDo(st); return(RedirectToAction("Details", "ToDo", new { id = stm.TID })); } else { return(View(stm)); } }