public ActionResult Delete(UserMD Data) { RepositoryUser repo = new RepositoryUser(); OperationResult <UserViewModel> result = repo.Delete(Data); return(Json(result)); }
public async Task <IActionResult> Delete(int id) { if (id > 0) { User data = _repo.GetDetails(id); _repo.Delete(data); if (await _repo.SaveChanges()) { return(NoContent()); } } return(BadRequest("Failed")); }
public HttpResponseMessage Delete(HttpRequestMessage request, int id) { try { using (RepositoryUser rep = new RepositoryUser()) { rep.Delete((p => p.ID == id)); rep.SaveAll(); return(request.CreateResponse(HttpStatusCode.Accepted)); } } catch (Exception e) { return(request.CreateErrorResponse(HttpStatusCode.BadRequest, e.Message)); } }