コード例 #1
0
 public ActionResult Delete(int id, Director collection)
 {
     try
     {
         // TODO: Add delete logic here
         var result = _directorRepository.ObterPorId(collection.DirectorId);
         _directorRepository.Remover(result);
         var message = new Message(new string[] { result.Email }, "Remover director", $"Oi {result.Nome}, os seus dados foram removidos.", null);
         if (Notificar(message))
         {
             return(RedirectToAction("Index", new { msg = "Director removido.", type = "danger" }));
         }
         else
         {
             return(PartialView("_Remover", collection));
         }
     }
     catch
     {
         return(PartialView("_Remover", collection));
     }
 }