Exemple #1
0
        public ActionResult PostOrder(CustomerOrder customerOrder)
        {
            var orders = JsonConvert.DeserializeObject <List <Order> >(customerOrder.Items);

            try
            {
                foreach (var item in orders)
                {
                    _stocksService.UpdateItemQuantity(Guid.Parse(item.Id), item.Quantity);
                }
            }
            catch (Exception ex)
            {
                return(new HttpStatusCodeResult(500, ex.Message));
            }

            _currentUserService.UpdateBalance(customerOrder.TotalSum);
            var newBalance = _currentUserService.GetBalance();

            return(Redirect(Request.UrlReferrer.ToString()));
        }