Пример #1
0
 public ActionResult DeleteConfirmed(int id, DeleteAdDto model)
 {
     model.Id     = id;
     model.UserId = GetUserId().Result;
     _deleteAdCommand.Execute(model);
     return(RedirectToAction("Index"));
 }
Пример #2
0
        public IActionResult Delete(int id)
        {
            var request = new DeleteAdDto();

            request.Id     = id;
            request.UserId = GetUserId().Result;
            try
            {
                _deleteAdCommand.Execute(request);
                return(Ok());
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
Пример #3
0
 public ActionResult Delete(int id, AdDTO ad)
 {
     try
     {
         _deleteAdCommand.Execute(ad);
         return(RedirectToAction(nameof(Index)));
     }
     catch (EntityNotFoundException)
     {
         return(View());
     }
     catch (Exception)
     {
         return(RedirectToAction("index"));
     }
 }