public PartialViewResult _DeleteDocente(int DocenteId) { var vm = new DeleteDocenteViewModel(); vm.DocenteId = DocenteId; return(PartialView(vm)); }
public ActionResult DeleteDocente(DeleteDocenteViewModel model) { try { using (var ts = new TransactionScope()) { var teacher = context.Docente.Find(model.DocenteId); if (teacher is null) { return(null); } teacher.Estado = ConstantHelper.Estado.INACTIVO; context.SaveChanges(); ts.Complete(); PostMessage(MessageType.Success, "Docente eliminado correctamente"); return(RedirectToAction("ListDocente", "Teacher")); } } catch (Exception ex) { Console.WriteLine(ex); return(new EmptyResult()); } }