Exemplo n.º 1
0
        private void Send()
        {
            SmtpEmailSender mailSender = new SmtpEmailSender("mail.texac.od.ua", "*****@*****.**", "tehas21032017!");//Properties.Settings.Default.SmtpServer, Properties.Settings.Default.EmailFrom, Properties.Settings.Default.EmailPassword);
            var             op         = new LoadCartOperation(_cartModel, _gameModel);

            op.ExcecuteTransaction();
            FullCartModel model = new FullCartModel
            {
                Games    = op._games,
                Products = op._products,
                Email    = new UserEmailMessage
                {
                    Date     = DateTime.Now,
                    Message  = _message,
                    Phone    = _phone,
                    Username = _name,
                    Type     = _type,
                },
            };

            var body = SmtpEmailSender.GetHtmlRazor(model, SmtpEmailSender.FormatUrl("OrderMailView"));


            mailSender.Send("*****@*****.**", "Новый заказ", body);
        }
Exemplo n.º 2
0
        public ActionResult Index()
        {
            var cart = SessionHelpers.Session("Cart") as List <CartModel>;
            var game = SessionHelpers.Session("Game") as List <GameModel>;

            ViewBag.NoProducts = true;
            ViewBag.NoGames    = true;
            if (cart != null || game != null)
            {
                var operation = new LoadCartOperation(cart, game);
                operation.ExcecuteTransaction();
                if (operation._products != null && operation._products.Count > 0)
                {
                    ViewBag.NoProducts = false;
                }
                ViewBag.Products = operation._products;
                if (operation._games != null && operation._games.Count > 0)
                {
                    ViewBag.NoGames = false;
                }
                ViewBag.Games = operation._games;
                return(View());
            }
            return(View());
        }
Exemplo n.º 3
0
        public ActionResult ChangeQuantity(CartModel model)
        {
            if (model.Quantity < 0)
            {
                return(Json(new { NoError = false }));
            }
            var cart = SessionHelpers.Session("Cart") as List <CartModel> ?? new List <CartModel>();
            var game = SessionHelpers.Session("Game") as List <GameModel> ?? new List <GameModel>();
            var prod = cart.Find(x => x.Id == model.Id);

            if (prod == null && model.Quantity > 0)
            {
                cart.Add(model);
            }
            else if (prod != null && model.Quantity > 0)
            {
                prod.Quantity = model.Quantity;
            }
            else if (prod != null && model.Quantity == 0)
            {
                cart.Remove(prod);
            }
            SessionHelpers.Session("Cart", cart);

            var operation = new LoadCartOperation(cart, game);

            operation.ExcecuteTransaction();
            if (operation._products != null && operation._products.Count > 0)
            {
                ViewBag.NoProducts = false;
            }
            if (operation._games != null && operation._games.Count > 0)
            {
                ViewBag.NoGames = false;
            }

            return(PartialView("Partial/_cartList", new FullCartModel {
                Products = operation._products, Games = operation._games
            }));
        }