public ActionResult DeleteConfirmed(long id) { FacilitiesPost facilities = _facilitiesService.GetPost(id); facilities.UserName = User.Identity.Name; _facilitiesService.Delete(facilities); return(RedirectToAction("Index")); }
public IHttpActionResult Delete(int id) { try { service.Delete(id); return(StatusCode(HttpStatusCode.NoContent)); } catch (NotSupportedException) { return(BadRequest()); } catch (UnauthorizedAccessException) { return(StatusCode(HttpStatusCode.Forbidden)); } catch (KeyNotFoundException) { return(NotFound()); } }