예제 #1
0
 public IActionResult Edit(Tarefa tarefa)
 {
     if (ModelState.IsValid)
     {
         TarefaRepo.Update(tarefa);
         return(RedirectToAction("Index"));
     }
     return(View(tarefa));
 }
예제 #2
0
        public IActionResult Delete(Tarefa tarefa)
        {
            Tarefa tar = TarefaRepo.GetTarefa(tarefa.Id_Tarefa);

            if (tar != null)
            {
                TarefaRepo.Delete(tarefa.Id_Tarefa);
                TempData["Message"] = "Tarefa " + tar.Descricao + " foi removida";
            }
            return(RedirectToAction("Index"));
        }
예제 #3
0
        public IActionResult Delete(long?id)
        {
            if (id == null)
            {
                return(BadRequest());
            }
            Tarefa tarefa = TarefaRepo.GetTarefa(id.Value);

            if (tarefa == null)
            {
                return(NotFound());
            }
            return(View(tarefa));
        }
예제 #4
0
        public IActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(BadRequest());
            }
            Tarefa tarefa = TarefaRepo.GetTarefa(id.Value);

            if (tarefa == null)
            {
                return(NotFound());
            }
            ViewBag.Projetos = ProjetoRepo.ListarProjetos();
            return(View(tarefa));
        }
예제 #5
0
 public IActionResult Create(Tarefa tarefa)
 {
     TarefaRepo.Add(tarefa);
     return(RedirectToAction("Index"));
 }
예제 #6
0
 public IActionResult Index()
 {
     return(View(TarefaRepo.ListarTarefas()));
 }