Esempio n. 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()));
        }
Esempio n. 2
0
        public static int Balance(this HtmlHelper html)
        {
            CurrentUserService currentUserService = DependencyResolver.Current.GetService <CurrentUserService>();

            return(currentUserService.GetBalance());
        }