public ActionResult DeleteConfirmed(int id, DeleteAdDto model) { model.Id = id; model.UserId = GetUserId().Result; _deleteAdCommand.Execute(model); return(RedirectToAction("Index")); }
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)); } }
public ActionResult Delete(int id, AdDTO ad) { try { _deleteAdCommand.Execute(ad); return(RedirectToAction(nameof(Index))); } catch (EntityNotFoundException) { return(View()); } catch (Exception) { return(RedirectToAction("index")); } }