Example #1
0
        public IActionResult Update([FromBody] FoodOrder foodOrder)
        {
            if (foodOrder == null)
            {
                return(BadRequest());
            }
            string   userJWTId = User.FindFirst("id")?.Value;
            Customer customer  = dbFoodOrder.GetCustomer(userJWTId);

            if (customer != null)
            {
                foodOrder.CustomerId = customer.Id;
            }
            foodOrder.TotalCost = ml.GetTotalCost(foodOrder);
            dbFoodOrder.Update(foodOrder);
            dbFoodOrder.Save();
            return(Ok(foodOrder));
        }