// DELETE: api/Posts/5 public async Task <string> Delete(int id) { var success = await PostGenericFacade.DeleteAsync(id); if (!success) { throw new HttpResponseException(HttpStatusCode.NotFound); } return($"Deleted post with id: {id}"); }
public async Task <ActionResult> DeletePost(int id) { try { await PostGenericFacade.DeleteAsync(id); return(RedirectToAction("Index")); } catch { return(View()); } }