Beispiel #1
0
 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!"));
     }
 }
Beispiel #2
0
        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!"));
            }
        }