private async Task AddToBasket(IDialogContext context, JObject json, int quantity) { BotData userData = await identityService.GetBotDataAsync(context); AuthUser authUser = userData.GetUserAuthData(); // TODO Check Expired if (authUser != null) { var reply = context.MakeMessage(); var producName = json.GetValue("ProductName").ToString(); var product = new BasketItem() { Id = Guid.NewGuid().ToString(), Quantity = quantity, ProductName = producName, PictureUrl = UIHelper.ReplacePictureUri(json.GetValue("PictureUrl").ToString()), UnitPrice = json.GetValue("UnitPrice").ToObject <decimal>(), ProductId = json.GetValue("ProductId").ToString(), }; await basketService.AddItemToBasket(authUser.UserId, product, authUser.AccessToken); reply.Text = string.Format(TextResources.You_have_added_to_your_basket, producName); context.Call(dialogFactory.CreateBasketDialog(), BasketAsync); } }
public Task Basket(IDialogContext context, LuisResult result) { context.Call(dialogFactory.CreateBasketDialog(), ResumeAfterDialog); return(Task.CompletedTask); }