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; }
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; }
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 } )); }
public ViewModelService(II18NService ii18NService) => _ii18NService = ii18NService;
public object OpenTypeList(II18NService i18NService) => new MenuViewModel( i18NService["headers.choose-type"], _productService.GetProducts() .GetGroups(p => p.Type) .Select(CreateTypeListItem) );
public object OpenCategoryList(II18NService i18NService) => new MenuViewModel( i18NService["headers.choose-category"], _productService.GetProducts() .GetGroups(p => p.Category) .Select(CreateCategoryItem) );