public async Task <CatalogViewModel <Order> > BuildModelAsync(ComponentModelBase componentModel) { var viewModel = this.catalogModelBuilder.BuildModel <CatalogViewModel <Order>, Order>(); viewModel.Title = this.orderLocalizer.GetString("Orders"); viewModel.NewText = this.orderLocalizer.GetString("NewOrder"); viewModel.NewUrl = this.linkGenerator.GetPathByAction("Index", "Order", new { Area = "Orders", culture = CultureInfo.CurrentUICulture.Name }); viewModel.EditUrl = this.linkGenerator.GetPathByAction("Edit", "Order", new { Area = "Orders", culture = CultureInfo.CurrentUICulture.Name }); viewModel.SearchApiUrl = this.linkGenerator.GetPathByAction("Get", "OrdersApi", new { Area = "Orders", culture = CultureInfo.CurrentUICulture.Name }); viewModel.OrderBy = $"{nameof(Order.CreatedDate)} desc"; viewModel.Table = new CatalogTableViewModel { Labels = new string[] { this.globalLocalizer.GetString("ClientName"), this.globalLocalizer.GetString("OrderStatus"), this.globalLocalizer.GetString("LastModifiedDate"), this.globalLocalizer.GetString("CreatedDate") }, Actions = new List <CatalogActionViewModel> { new CatalogActionViewModel { IsEdit = true } }, Properties = new List <CatalogPropertyViewModel> { new CatalogPropertyViewModel { Title = nameof(Order.ClientName).ToCamelCase(), IsDateTime = false }, new CatalogPropertyViewModel { Title = nameof(Order.OrderStatusName).ToCamelCase(), IsDateTime = false }, new CatalogPropertyViewModel { Title = nameof(Order.LastModifiedDate).ToCamelCase(), IsDateTime = true }, new CatalogPropertyViewModel { Title = nameof(Order.CreatedDate).ToCamelCase(), IsDateTime = true } } }; viewModel.PagedItems = await this.ordersRepository.GetOrdersAsync(componentModel.Token, componentModel.Language, null, Foundation.GenericRepository.Definitions.Constants.DefaultPageIndex, Foundation.GenericRepository.Definitions.Constants.DefaultItemsPerPage, $"{nameof(Order.CreatedDate)} desc"); return(viewModel); }
public async Task <IActionResult> Regulations() { var componentModel = new ComponentModelBase { Language = CultureInfo.CurrentUICulture.Name }; var viewModel = await this.regulationsPageModelBuilder.BuildModelAsync(componentModel); return(this.View(viewModel)); }
public async Task <IActionResult> Index() { var componentModel = new ComponentModelBase { Language = CultureInfo.CurrentUICulture.Name, Token = await HttpContext.GetTokenAsync(ApiExtensionsConstants.TokenName) }; var viewModel = await this.settingsPageModelBuilder.BuildModelAsync(componentModel); return(this.View(viewModel)); }
public async Task <IActionResult> Index() { var componentModel = new ComponentModelBase { Language = CultureInfo.CurrentUICulture.Name, Token = await HttpContext.GetTokenAsync(ApiExtensionsConstants.TokenName), SellerId = GuidHelper.ParseNullable((this.User.Identity as ClaimsIdentity).Claims.FirstOrDefault(x => x.Type == AccountConstants.Claims.OrganisationIdClaim)?.Value) }; var viewModel = await this.orderPageModelBuilder.BuildModelAsync(componentModel); return(this.View(viewModel)); }
public async Task <IActionResult> Edit(Guid?id) { var componentModel = new ComponentModelBase { Id = id, Language = CultureInfo.CurrentUICulture.Name, Token = await HttpContext.GetTokenAsync(ApiExtensionsConstants.TokenName) }; var viewModel = await this.categoryPageModelBuilder.BuildModelAsync(componentModel); return(this.View(viewModel)); }
public async Task <IActionResult> Index() { var componentModel = new ComponentModelBase { Language = CultureInfo.CurrentUICulture.Name, IsAuthenticated = this.User.Identity.IsAuthenticated, Name = this.User.Identity.Name, Token = await HttpContext.GetTokenAsync(ApiExtensionsConstants.TokenName), BasketId = string.IsNullOrWhiteSpace(this.Request.Cookies[BasketConstants.BasketCookieName]) ? null : Guid.Parse(this.Request.Cookies[BasketConstants.BasketCookieName]) }; var viewModel = await this.availableProductsPageModelBuilder.BuildModelAsync(componentModel); return(this.View(viewModel)); }
public async Task <IActionResult> Index() { var componentModel = new ComponentModelBase { Language = CultureInfo.CurrentUICulture.Name, IsAuthenticated = this.User.Identity.IsAuthenticated, Name = this.User.Identity.Name, SellerId = GuidHelper.ParseNullable((this.User.Identity as ClaimsIdentity).Claims.FirstOrDefault(x => x.Type == AccountConstants.Claims.OrganisationIdClaim)?.Value), Token = await HttpContext.GetTokenAsync(ApiExtensionsConstants.TokenName), BasketId = string.IsNullOrWhiteSpace(this.Request.Cookies[BasketConstants.BasketCookieName]) ? null : Guid.Parse(this.Request.Cookies[BasketConstants.BasketCookieName]) }; var viewModel = await this.ordersPageModelBuilder.BuildModelAsync(componentModel); return(this.View(viewModel)); }
public async Task <CatalogViewModel <ProductAttributeItem> > BuildModelAsync(ComponentModelBase componentModel) { var viewModel = this.catalogModelBuilder.BuildModel <CatalogViewModel <ProductAttributeItem>, ProductAttributeItem>(); viewModel.NewText = this.productLocalizer.GetString("NewProductAttributeItem"); viewModel.NewUrl = this.linkGenerator.GetPathByAction("New", "ProductAttributeItem", new { Id = componentModel.Id, Area = "Products", culture = CultureInfo.CurrentUICulture.Name }); viewModel.EditUrl = this.linkGenerator.GetPathByAction("Edit", "ProductAttributeItem", new { Area = "Products", culture = CultureInfo.CurrentUICulture.Name }); viewModel.DeleteApiUrl = this.linkGenerator.GetPathByAction("Delete", "ProductAttributeItemsApi", new { Area = "Products", culture = CultureInfo.CurrentUICulture.Name }); viewModel.SearchApiUrl = this.linkGenerator.GetPathByAction("Get", "ProductAttributeItemsApi", new { ProductAttributeId = componentModel.Id, Area = "Products", culture = CultureInfo.CurrentUICulture.Name }); viewModel.OrderBy = $"{nameof(ProductAttributeItem.CreatedDate)} desc"; viewModel.Table = new CatalogTableViewModel { Labels = new string[] { this.globalLocalizer.GetString("Name"), this.globalLocalizer.GetString("LastModifiedDate"), this.globalLocalizer.GetString("CreatedDate") }, Actions = new List <CatalogActionViewModel> { new CatalogActionViewModel { IsEdit = true }, new CatalogActionViewModel { IsDelete = true } }, Properties = new List <CatalogPropertyViewModel> { new CatalogPropertyViewModel { Title = nameof(ProductAttributeItem.Name).ToCamelCase(), IsDateTime = false }, new CatalogPropertyViewModel { Title = nameof(ProductAttributeItem.LastModifiedDate).ToCamelCase(), IsDateTime = true }, new CatalogPropertyViewModel { Title = nameof(ProductAttributeItem.CreatedDate).ToCamelCase(), IsDateTime = true } } }; viewModel.PagedItems = await this.productAttributeItemsRepository.GetAsync( componentModel.Token, componentModel.Language, componentModel.Id, null, Foundation.GenericRepository.Definitions.Constants.DefaultPageIndex, Foundation.GenericRepository.Definitions.Constants.DefaultItemsPerPage, $"{nameof(ProductAttributeItem.CreatedDate)} desc"); return(viewModel); }
public async Task <CatalogViewModel <InventoryItem> > BuildModelAsync(ComponentModelBase componentModel) { var viewModel = this.catalogModelBuilder.BuildModel <CatalogViewModel <InventoryItem>, InventoryItem>(); viewModel.Title = this.inventoryLocalizer.GetString("Inventory"); viewModel.NewText = this.inventoryLocalizer.GetString("NewTextInventory"); viewModel.NewUrl = this.linkGenerator.GetPathByAction("Edit", "Inventory", new { Area = "Inventory", culture = CultureInfo.CurrentUICulture.Name }); viewModel.SearchApiUrl = this.linkGenerator.GetPathByAction("Get", "InventoriesAPi", new { Area = "Inventory", culture = CultureInfo.CurrentUICulture.Name }); viewModel.EditUrl = this.linkGenerator.GetPathByAction("Edit", "Inventory", new { Area = "Inventory", culture = CultureInfo.CurrentUICulture.Name }); viewModel.DeleteApiUrl = this.linkGenerator.GetPathByAction("Delete", "InventoriesApi", new { Area = "Inventory", culture = CultureInfo.CurrentUICulture.Name }); viewModel.OrderBy = $"{nameof(InventoryItem.ProductSku)} ASC"; viewModel.Table = new CatalogTableViewModel { Labels = new string[] { this.inventoryLocalizer.GetString("Warehouse"), this.inventoryLocalizer.GetString("SelectProductLabel"), this.inventoryLocalizer.GetString("Sku"), this.inventoryLocalizer.GetString("QuantityLabel"), this.inventoryLocalizer.GetString("AvailableQuantityLabel"), this.globalLocalizer.GetString("LastModifiedDate"), this.globalLocalizer.GetString("CreatedDate") }, Actions = new List <CatalogActionViewModel> { new CatalogActionViewModel { IsEdit = true }, new CatalogActionViewModel { IsDelete = true } }, Properties = new List <CatalogPropertyViewModel> { new CatalogPropertyViewModel { Title = nameof(InventoryItem.WarehouseName).ToCamelCase(), IsDateTime = false }, new CatalogPropertyViewModel { Title = nameof(InventoryItem.ProductName).ToCamelCase(), IsDateTime = false }, new CatalogPropertyViewModel { Title = nameof(InventoryItem.ProductSku).ToCamelCase(), IsDateTime = false }, new CatalogPropertyViewModel { Title = nameof(InventoryItem.Quantity).ToCamelCase(), IsDateTime = false }, new CatalogPropertyViewModel { Title = nameof(InventoryItem.AvailableQuantity).ToCamelCase(), IsDateTime = false }, new CatalogPropertyViewModel { Title = nameof(InventoryItem.LastModifiedDate).ToCamelCase(), IsDateTime = true }, new CatalogPropertyViewModel { Title = nameof(InventoryItem.CreatedDate).ToCamelCase(), IsDateTime = true } } }; viewModel.PagedItems = await this.inventoryRepository.GetInventoryProductsAsync(componentModel.Token, componentModel.Language, null, Foundation.GenericRepository.Definitions.Constants.DefaultPageIndex, Foundation.GenericRepository.Definitions.Constants.DefaultItemsPerPage, $"{nameof(InventoryItem.ProductSku)} ASC"); return(viewModel); }