public async Task GetTest()
        {
            var rtn = new GetBadgeLastOrderQuery(_context);

            var result = await rtn.GetAsync("123");

            result.ShouldBeOfType <BadgeLastOrderPreviewModel>();

            result.DrinkTypeModelPreview.Count.ShouldBe(3);
        }
        public async Task SaveTest()
        {
            var rtn = new GetBadgeLastOrderQuery(_context);

            var result = await rtn.GetAsync("125");

            var cmd       = new CreateOrderBadgeLastOrderCommand(_context);
            var cmdResult = await cmd.SaveAsync(result);

            cmdResult.ShouldBe(2);
        }
Beispiel #3
0
        public async Task <IActionResult> OrderCoffee(string BadgeNo)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            if (string.IsNullOrWhiteSpace(BadgeNo))
            {
                return(RedirectToAction("Index", "Home"));
            }
            var rtn = new GetBadgeLastOrderQuery(_context);

            BadgeLastOrderPreviewModel ViewModel = await rtn.GetAsync(BadgeNo);

            ViewModel.BadgeNo = BadgeNo;
            return(View(ViewModel));
        }
        public async Task <BadgeLastOrderPreviewModel> GetAsync(string BadgeNo)
        {
            var rtn = new GetBadgeLastOrderQuery(_context);

            return(await rtn.GetAsync(BadgeNo));
        }