Esempio n. 1
0
 public override void OnActionExecuting(ActionExecutingContext filterContext)
 {
     if (filterContext != null)
     {
         ShopSession session = new ShopSession();
         session.CheckSession(filterContext.HttpContext.Session);
     }
 }
Esempio n. 2
0
        public async Task ShopAsync(Shop shop)
        {
            if (!Context.Account.CanShop)
            {
                return;
            }

            var session = new ShopSession(Context, shop);

            await StartSessionAsync(session);

            Context.Account.CanShop = true;
        }
Esempio n. 3
0
            public async Task <Unit> Handle(Execute request, CancellationToken cancellationToken)
            {
                var shopSession = new ShopSession
                {
                    CreatedAt = request.CreatedAt
                };

                _context.ShopSession.Add(shopSession);
                var value = await _context.SaveChangesAsync();

                if (value == 0)
                {
                    throw new Exception("There was an error on shop session");
                }

                int id = shopSession.ShopSessionId;

                foreach (var obj in request.DetailList)
                {
                    var sessionDetail = new ShopSessionDetail
                    {
                        CreatedAt       = DateTime.Now,
                        ShopSessionId   = id,
                        SelectedProduct = obj
                    };

                    _context.ShopSessionDetail.Add(sessionDetail);
                }

                value = await _context.SaveChangesAsync();

                if (value > 0)
                {
                    return(Unit.Value);
                }

                throw new Exception("Products detail could not be saved");
            }
Esempio n. 4
0
 public void setShopSession(ShopSession shopSession)
 {
     this.shopSession = shopSession;
 }
Esempio n. 5
0
 public void setShopSession(ShopSession shopSession)
 {
     this.shopSession = shopSession;
 }
Esempio n. 6
0
 public void Accredit(UserToken token, Action<UserToken, SessionHandle> accreditSession)
 {
     var session = new ShopSession();
     session.Identity = (Program.identity++).ToString();
     accreditSession(token, session);
 }