Example #1
0
        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));
            }
        }
Example #2
0
        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 }));
            }
        }
Example #3
0
        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));
        }
Example #4
0
        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));
            }
        }