Пример #1
0
        public SubToDo AddSubToDo(SubToDo st, int todoID)
        {
            var s = st;

            s.ToDo = todoes.GetToDo(todoID);
            context.Add(s);
            context.SaveChanges();
            return(s);
        }
Пример #2
0
        public SubToDo EditSubToDo(SubToDo st)
        {
            var s = GetSubToDo(st.ID);

            s.Name        = st.Name;
            s.Description = st.Description;
            s.State       = st.State;
            context.SaveChanges();
            return(s);
        }
Пример #3
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));
            }
        }
Пример #4
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));
        }