Beispiel #1
0
        // GET: ToDo
        public ActionResult Index()
        {
            ToDoModels model = new ToDoModels();

            model.TaskList = Db.Task.ToList();
            return(View(model));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            ToDoModels toDoModels = db.ToDoModels.Find(id);

            db.ToDoModels.Remove(toDoModels);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #3
0
        public ActionResult EditItem(ToDoModels model)
        {
            Task toDo = Db.Task.First(x => x.Id == model.Id);

            model.Id       = toDo.Id;
            model.Taskname = toDo.TaskName;
            model.TaskList = Db.Task.ToList();
            return(View("Index", model));
        }
Beispiel #4
0
        public ActionResult RemoveItem(ToDoModels model)
        {
            Task toDo = Db.Task.First(x => x.Id == model.Id);

            Db.Task.Remove(toDo);

            Db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        // GET: ToDoModels/Create
        public ActionResult Create()
        {
            ToDoModels todo = new ToDoModels();

            {
                todo.PersonId = (int)Session["iduser"];
                todo.Date     = DateTime.Now;
            };
            return(View(todo));
        }
 public ActionResult Edit([Bind(Include = "ID,Title,Details,Date,IsDone,PersonId")] ToDoModels toDoModels)
 {
     if (ModelState.IsValid)
     {
         db.Entry(toDoModels).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(toDoModels));
 }
Beispiel #7
0
        //
        // GET: /Home/Delete/5

        public ActionResult Delete(int id = 0)
        {
            ToDoModels todomodels = db.ToDoes.Find(id);

            if (todomodels == null)
            {
                return(HttpNotFound());
            }
            return(View(todomodels));
        }
Beispiel #8
0
 public ActionResult Edit(ToDoModels todomodels)
 {
     if (ModelState.IsValid)
     {
         db.Entry(todomodels).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(todomodels));
 }
        public ActionResult Create([Bind(Include = "ID,Title,Details,Date,IsDone,PersonId")] ToDoModels toDoModels)
        {
            if (ModelState.IsValid)
            {
                db.ToDoModels.Add(toDoModels);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(toDoModels));
        }
Beispiel #10
0
        public ActionResult Create(ToDoModels todomodels)
        {
            if (ModelState.IsValid)
            {
                db.ToDoes.Add(todomodels);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(todomodels));
        }
        // GET: ToDoModels/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ToDoModels toDoModels = db.ToDoModels.Find(id);

            if (toDoModels == null)
            {
                return(HttpNotFound());
            }
            return(View(toDoModels));
        }
Beispiel #12
0
        public ActionResult AddItem(ToDoModels model)
        {
            if (model.Id == 0)
            {
                Db.Task.Add(new Task {
                    TaskName = model.Taskname
                });
                Db.SaveChanges();
            }
            else
            {
                Task EditToDo = Db.Task.First(x => x.Id == model.Id);
                EditToDo.Id       = model.Id;
                EditToDo.TaskName = model.Taskname;
                Db.SaveChanges();

                //newdata.Deletekey = 0;
            }
            return(RedirectToAction("Index"));
        }