示例#1
0
 public ActionResult GetTask()
 {
     Bd = new BDHelperTask();
     Bd.GetAllTaskGrid();
     ModelState.Clear();
     return(View(Bd.GetAllTaskGrid()));
 }
示例#2
0
 public ActionResult EditTask(int idTask, Task taskObj)
 {
     try
     {
         Bd = new BDHelperTask();
         Bd.UpdateTask(taskObj);
         return(RedirectToAction("GetTask"));
     }
     catch (Exception)
     {
         return(View("GetTask"));
     }
 }
示例#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"));
     }
 }
示例#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"));
            }
        }
示例#5
0
 // [HttpGet]
 public ActionResult EditTask(int idTask)
 {
     Bd = new BDHelperTask();
     return(View(Bd.GetAllTask().Find(t => t.IdTask == idTask)));
 }