Ejemplo n.º 1
0
        public IActionResult CompleteOrder(int id)
        {
            var order = _ordersRepo.GetOrderById(id);

            if (order == null)
            {
                return(View("StatusCodes/OrderNotFound"));
            }

            order.IsCompleted = true;
            if (!_ordersRepo.SaveChanges())
            {
                return(BadRequest());
            }

            return(RedirectToAction("Get", "Orders"));
        }
 /// <summary>
 /// Saves changes to repository
 /// </summary>
 public void SaveChanges()
 {
     repo.SaveChanges();
 }