//[BasicAuthentication] //[AutorizeByRole(AutorizeByRoleAttribute.roles.Admin)] public HttpResponseMessage DeleteCarForRent(int rentNumber) { try { int i = carForRentRepository.DeleteCarForRent(rentNumber); if (i > 0) { HttpResponseMessage hrm = new HttpResponseMessage(HttpStatusCode.NoContent) { }; return(hrm); } HttpResponseMessage hr = new HttpResponseMessage(HttpStatusCode.InternalServerError) { }; return(hr); } catch (Exception ex) { Errors errors = ErrorsHelper.GetErrors(ex); HttpResponseMessage hr = new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent(errors.ToString()) }; return(hr); } }
public HttpResponseMessage DeleteForRent(string number) { try { int i = carForRentRepository.DeleteCarForRent(number); return(Request.CreateResponse(HttpStatusCode.NoContent)); } catch (Exception ex) { Errors errors = ErrorsHelper.GetErrors(ex); return(Request.CreateResponse(HttpStatusCode.InternalServerError, errors)); } }
public IActionResult DeleteForRent(string number) { try { int i = carForRentRepository.DeleteCarForRent(number); return(NoContent()); } catch (Exception ex) { Errors errors = ErrorsHelper.GetErrors(ex); return(StatusCode(StatusCodes.Status500InternalServerError, errors)); } }