Beispiel #1
0
 public ActionResult GetTask()
 {
     Bd = new BDHelperTask();
     Bd.GetAllTaskGrid();
     ModelState.Clear();
     return(View(Bd.GetAllTaskGrid()));
 }
Beispiel #2
0
 public ActionResult EditTask(int idTask, Task taskObj)
 {
     try
     {
         Bd = new BDHelperTask();
         Bd.UpdateTask(taskObj);
         return(RedirectToAction("GetTask"));
     }
     catch (Exception)
     {
         return(View("GetTask"));
     }
 }
Beispiel #3
0
 public ActionResult DeleteTask(int idTask)
 {
     try
     {
         Bd = new BDHelperTask();
         if (Bd.DeleteTask(idTask))
         {
             ViewBag.Mensagem = "Task deleted!";
         }
         return(RedirectToAction("GetTask"));
     }
     catch (Exception)
     {
         return(View("GetTask"));
     }
 }
Beispiel #4
0
        public ActionResult AddTask(Task taskObj)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    int newstatus = Convert.ToInt32(Request.Form["selectStatus"]);

                    Bd = new BDHelperTask();
                    int newId = Bd.GetCountTask() + 1;
                    taskObj.IdTask = newId;
                    if (Bd.AddNewTask(taskObj))
                    {
                        ViewBag.Mensagem = "Task added!";
                    }
                }
                return(RedirectToAction("GetTask"));
            }
            catch (Exception)
            {
                return(View("GetTask"));
            }
        }
Beispiel #5
0
 // [HttpGet]
 public ActionResult EditTask(int idTask)
 {
     Bd = new BDHelperTask();
     return(View(Bd.GetAllTask().Find(t => t.IdTask == idTask)));
 }