Пример #1
0
        public async Task <ActionResult> Delete(object id)
        {
            _trainService.Delete(id);
            await _unitOfWork.CommitAsync();

            return(RedirectToAction("Index"));
        }
Пример #2
0
        public IActionResult Delete(string id)
        {
            if (!trainService.HasWithId(id))
            {
                return(Redirect("/Home/Index"));
            }

            trainService.Delete(id);

            return(Redirect("/Home/Index"));
        }
Пример #3
0
        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"));
        }
Пример #4
0
        public IActionResult Delete(Guid id)
        {
            trainService.Delete(trainService.GetById(id));

            return(RedirectToAction("Index"));
        }
Пример #5
0
 public ActionResult Delete(int id)
 {
     _TrainService.Delete(id);
     return(RedirectToAction("Index"));
 }