public async Task <ActionResult> Delete(object id) { _trainService.Delete(id); await _unitOfWork.CommitAsync(); return(RedirectToAction("Index")); }
public IActionResult Delete(string id) { if (!trainService.HasWithId(id)) { return(Redirect("/Home/Index")); } trainService.Delete(id); return(Redirect("/Home/Index")); }
public ActionResult Delete(int id) { if (IsAdmin) { try { TrainDetailDTO train = trainService.GetTrain(id); trainService.Delete(train.Id); return(Content("<h2>Поезд успешно удален</h2> <a href='/'> На главную </a>")); } catch (ValidationException ex) { return(Content(ex.Message)); } } return(RedirectToAction("Index")); }
public IActionResult Delete(Guid id) { trainService.Delete(trainService.GetById(id)); return(RedirectToAction("Index")); }
public ActionResult Delete(int id) { _TrainService.Delete(id); return(RedirectToAction("Index")); }