public async Task <IHttpActionResult> Delete(Guid id) { var item = await repository.Get(id); if (!authorizationService.IsAuthorized(item.FormId, user.Email, AuthorizationService.AuthorizationType.IsDelete, AuthorizationService.EndpointType.Data)) { return(Content(HttpStatusCode.Forbidden, "You are not authorized to perform this action.")); } else { repository.Delete(id); return(Content(HttpStatusCode.OK, "")); } }
public HttpResponseMessage Delete(int IntId) { HttpResponseMessage messageR; if (!ModelState.IsValid) { return(Request.CreateResponse(HttpStatusCode.BadRequest, ModelState)); } Task <string> a = _repository.Delete(IntId); if (a.Result.Length <= 0) { return(Request.CreateResponse(HttpStatusCode.OK)); } else { return(messageR = Request.CreateResponse(HttpStatusCode.BadRequest)); } }
public void Delete(int id) { valueRepository.Delete(id); }