Exemple #1
0
        public ActionResult Create([Bind(Include = "id,titulo,id_status,descricao,criacao,alteracao")] task task)
        {
            if (ModelState.IsValid)
            {
                db.tasks.Add(task);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.id_status = new SelectList(db.status, "id", "descricao", task.id_status);
            return(View(task));
        }
Exemple #2
0
        public ActionResult SaveNewTask(task newTask)
        {
            tasklistEntities ORM = new tasklistEntities();

            ORM.tasks.Add(newTask);

            ORM.SaveChanges();

            return(RedirectToAction("Index"));
        }
Exemple #3
0
        public ActionResult DeleteTask(int taskid)
        {
            tasklistEntities ORM = new tasklistEntities();

            task TaskToDelete = ORM.tasks.Find(taskid);

            ORM.tasks.Remove(TaskToDelete);

            ORM.SaveChanges();

            return(RedirectToAction("Index"));
        }
Exemple #4
0
        public ActionResult CompleteTask(int taskid)
        {
            tasklistEntities ORM = new tasklistEntities();

            task TaskToComplete = ORM.tasks.Find(taskid);

            if (TaskToComplete.status == false)
            {
                TaskToComplete.status = true;
            }
            else
            {
                TaskToComplete.status = false;
            }

            ORM.Entry(TaskToComplete).State = System.Data.Entity.EntityState.Modified;

            ORM.SaveChanges();

            return(RedirectToAction("Index"));
        }