Esempio n. 1
0
        public async Task <IActionResult> Get(LoadProductDetails input)
        {
            var rsp = await _bus.SendAsync <LoadProductDetails, ProductDetailsViewModel>(input);

            if (rsp.Result == null)
            {
                return(NotFound());
            }

            return(View("~/Features/ProductsDetails/Views/Index.cshtml", rsp.Result));
        }
        public async Task <IActionResult> Index(DetailsQuery query)
        {
            logger.Trace("Start requesting details page...");

            var taskGetDetails = bus.SendAsync <DetailsQuery, DetailsViewModel>(query);

            await Task.WhenAll(taskGetDetails, bus.PublishAsync(new DetailsPageRequestedEvent()));

            var response = taskGetDetails.Result;

            if (response.Value == null)
            {
                return(Redirect("~/"));
            }

            response.Value.IsSaved = savedItemsProvider.Get().Any(x => x == response.Value.Id);

            return(View(response.Value));
        }
Esempio n. 3
0
        public void PresentShowroomSection(ShowroomTestDataInput input, IRequestBus bus, IResponse <ShowroomViewModel> rsp)
        {
            var scope = Scope();

            $"Given current tenant is {input.Tenant}"
            .x(c => scope.Using(c).SetCurrentTenant(input.Tenant));
            $"And I have an instance of request bus"
            .x(() => bus = scope.RequestBus());
            $"When I sent request for showroom view model"
            .x(async() => rsp = await bus.SendAsync <ShowroomRequest, ShowroomViewModel>(new ShowroomRequest()));
            $"Then I should receive a showroom view model response"
            .x(() => rsp.IsSucceed.ShouldBeTrue());
            $"And view model should not be null"
            .x(() => rsp.Result.ShouldNotBeNull());
            $"And view model title should be correct"
            .x(() => rsp.Result.Heading.ShouldBe(input.ExpectedViewModel.Heading));
            $"And view model should have a link to view all"
            .x(() => rsp.Result.ViewAllLink.ShouldNotBeNull());
            $"And view model view all link should have correct text"
            .x(() => rsp.Result.ViewAllLink.Text.ShouldBe(input.ExpectedViewModel.ViewAllLink.Text));
            $"And view model view all link should have correct url"
            .x(() => rsp.Result.ViewAllLink.Url.ShouldBe(input.ExpectedViewModel.ViewAllLink.Url));
        }
Esempio n. 4
0
        public async Task <IActionResult> Post(LoginRequest request)
        {
            var rsp = await _bus.SendAsync(request);

            return(rsp.ToRedirectResponse("/"));
        }
Esempio n. 5
0
        public async Task <IActionResult> Post(RegisterUser input)
        {
            await _bus.SendAsync(input);

            return(Redirect("/"));
        }