Example #1
0
        // POST: api/OrderItems
        public async Task <HttpResponseMessage> Post([FromBody] OrderItemViewModel item)
        {
            HttpResponseMessage response;

            try
            {
                await _orderItemService.AddToOrder(_mapper.Map <OrderItemDto>(item));

                response = Request.CreateResponse(HttpStatusCode.OK);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                response = Request.CreateResponse(HttpStatusCode.InternalServerError);
            }

            return(response);
        }