예제 #1
0
 public CartController(
     ProductService productService,
     CartService cartService,
     II18NService i18NService,
     ViewModelService viewModelService,
     RouteValueDictionary routeValues,
     IBotInputChat chat
     )
 {
     _productService   = productService;
     _routeValues      = routeValues;
     _cartService      = cartService;
     _chat             = chat;
     _i18NService      = i18NService;
     _viewModelService = viewModelService;
 }
예제 #2
0
 public OrderController(
     CartService cartService,
     RouteValueDictionary routeValues,
     ChatService chatService,
     OrderService orderService,
     ViewModelService viewModelService,
     II18NService i18NService,
     IBotInputChat chat
     )
 {
     _cartService      = cartService;
     _routeValues      = routeValues;
     _chatService      = chatService;
     _orderService     = orderService;
     _viewModelService = viewModelService;
     _i18NService      = i18NService;
     _chat             = chat;
 }
예제 #3
0
        public object OpenProductList(II18NService i18NService)
        {
            var category           = _routeValues.GetValue("category");
            var type               = _routeValues.GetValue("type");
            var page               = _routeValues.GetValue("page").ParseInt();
            var productPage        = _productService.Paginate(category, type, page, ProductPageLimit);
            var cards              = productPage.Items.Select(CreateCardFromProduct);
            var previousPageButton = page > 0
        ? CreatePaginationButton(category, type, page - 1, true)
        : null;
            var nextPageButton = page < productPage.Limit
        ? CreatePaginationButton(category, type, page + 1, false)
        : null;

            return(new CardPageView(
                       i18NService["headers.select-products"],
                       cards,
                       new[] { previousPageButton, nextPageButton }
                       ));
        }
예제 #4
0
 public ViewModelService(II18NService ii18NService) => _ii18NService = ii18NService;
예제 #5
0
 public object OpenTypeList(II18NService i18NService) => new MenuViewModel(
     i18NService["headers.choose-type"],
     _productService.GetProducts()
     .GetGroups(p => p.Type)
     .Select(CreateTypeListItem)
     );
예제 #6
0
 public object OpenCategoryList(II18NService i18NService) => new MenuViewModel(
     i18NService["headers.choose-category"],
     _productService.GetProducts()
     .GetGroups(p => p.Category)
     .Select(CreateCategoryItem)
     );