public HttpResponseMessage Put([FromBody] OrderSupplementLoginRequest orderSupplementLogin) { if (ModelState.IsValid && _customerRepository.IsAdmin(orderSupplementLogin)) { var result = _orderSupplementRepository.InsertOrderSupplementReference(orderSupplementLogin); if (result) { return(Request.CreateResponse(HttpStatusCode.OK, $"The orderimage was added")); } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, $"The orderimage was not added")); } } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Invalid credentials!")); } }
public HttpResponseMessage Delete([FromBody] OrderSupplementLoginRequest orderSupplementLogin) { if (ModelState.IsValid && _customerRepository.IsAdmin(orderSupplementLogin)) { var orderSupplementId = _orderSupplementRepository.GetOrderSupplementId(orderSupplementLogin); var result = _orderSupplementRepository.DeleteOrderSupplementReference(orderSupplementLogin); if (result) { return(Request.CreateResponse(HttpStatusCode.OK, $"The ordersupplement with {orderSupplementId} ID was deleted!")); } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, $"The ordersupplement with {orderSupplementLogin.OrderSupplementId} ID was not deleted")); } } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Invalid credentials!")); } }