public override void OnActionExecuting(ActionExecutingContext filterContext) { if (filterContext != null) { ShopSession session = new ShopSession(); session.CheckSession(filterContext.HttpContext.Session); } }
public async Task ShopAsync(Shop shop) { if (!Context.Account.CanShop) { return; } var session = new ShopSession(Context, shop); await StartSessionAsync(session); Context.Account.CanShop = true; }
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"); }
public void setShopSession(ShopSession shopSession) { this.shopSession = shopSession; }
public void Accredit(UserToken token, Action<UserToken, SessionHandle> accreditSession) { var session = new ShopSession(); session.Identity = (Program.identity++).ToString(); accreditSession(token, session); }