Esempio n. 1
0
        public async Task <IActionResult> OrderDetails([FromBody] ItemOrderDetails itm)
        {
            var responsecode = new response <string>();

            responsecode = await _repost.postItem(itm);

            return(Ok(responsecode));
        }
        public IActionResult Get(long id)
        {
            try
            {
                var details = new List <ItemOrderDetails>();
                foreach (ItemOrder item in _orderService.Get(id).Items)
                {
                    var detail = new ItemOrderDetails();
                    detail.Price       = item.Price;
                    detail.Quantity    = item.Quantity;
                    detail.ProductName = item.Product.Name;
                    details.Add(detail);
                }

                return(Ok(details));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(BadRequest(ex.Message));
            }
        }