public ActionResult DeleteTerminal(Guid siteId, Guid terminalId) { var terminalFromRepo = _terminalRepository.GetTerminal(siteId, terminalId); if (terminalFromRepo == null) { return(NotFound()); } _terminalRepository.DeleteTerminal(terminalFromRepo); _terminalRepository.Save(); return(NoContent()); }
public ActionResult DeleteConfirmed(int?id, string WorkingHoursId) { if (!User.IsInRole("Delete Terminal Documents")) //no puse Authorize porque no puedo controlar la redireccion si no tiene el permiso. Esto l ollama un ajax y es un partial de details. { return(PartialView("Sections/ErrorAccess")); } try { if (id == null) { ViewBag.Error = "Terminal not found. "; return(View("Error")); } _repository.DeleteTerminal((int)id); return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Error = "Validation error deleting Terminal" + ex.Message; return(RedirectToAction("Index")); } }