public IActionResult Delete(int?id) { if (!id.HasValue) { return(BadRequest()); } try { _commentsService.Delete(id.Value); } catch (Exception e) { Console.WriteLine(e); return(BadRequest()); } return(Ok()); }
public IActionResult Delete(int?id) { if (!id.HasValue) { return(RedirectToAction("List", "UserJobOffers")); } CommentEditViewModel model = commentsService.GetById(id.Value); if (model == null) { return(RedirectToAction("List", "UserJobOffers")); } commentsService.Delete(model.Id); return(RedirectToAction("Details", "UserJobOffers", new { id = model.JobOfferId })); }
public IActionResult Delete(int id) { var comment = _commentsService.GetById(id); if (comment == null) { return(RedirectToAction("ErrorNotFound", "Info")); } if (comment.UserId != int.Parse(User.FindFirst("Id").Value)) { return(RedirectToAction("AccessDenied", "Auth")); } _commentsService.Delete(comment); return(RedirectToAction("Details", "Recipes", new { id = comment.RecipeId })); }
public IActionResult Delete(int id, int eventId) { var response = _commentsService.Delete(id); try { if (response.IsSuccessful) { return(RedirectToAction("MoreInfo", "Events", new { SuccessMessage = "Comment deleted sucessfully", id = eventId })); } else { return(RedirectToAction("MoreInfo", "Events", new { ErrorMessage = response.Message, id = eventId })); } } catch (Exception) { return(RedirectToAction("ErrorNotFound", "Info")); } }
public async Task <IActionResult> Delete([FromQuery] CommentDeleteContract contract) { _ = await _service.Delete(contract); return(Ok()); }
public ActionResult DeleteComment(int commentId, string subjectTitle) { _commentsService.Delete(commentId); return(Redirect(String.Format("/Subjects/Subject?title={}", subjectTitle))); }
public async Task <IActionResult> Delete(string id) { await _commentsService.Delete(id); return(Ok()); }
public async Task <IActionResult> Delete([FromRoute] Guid couponId, [FromRoute] Guid commentId) { await _commentsService.Delete(couponId, commentId); return(NoContent()); }