public HttpResponseMessage Delete(int id) { try { _postService.RemoveById(id); return(Request.CreateResponse(HttpStatusCode.OK)); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Error")); } }
public ActionResult RemovePost(int postId) { // var post = _postService.GetById(postId); // int userId = post.AuthorId; // _postService.Remove(post); _postService.RemoveById(postId); var userPosts = _postService.GetPosts(_authProvider.CurrentUserId); if (Request.IsAjaxRequest()) { return(PartialView("UserPostsPartial", userPosts)); } return(RedirectToAction("UserPostsPartial", userPosts)); }