Пример #1
0
        public async Task <PartialViewResult> CreateOrUpdatePriceModal(long productId, long?id = null)
        {
            IPriceAppService       priceAppService = this._priceAppService;
            NullableIdInput <long> nullableIdInput = new NullableIdInput <long>()
            {
                Id = id
            };
            CreateOrUpdatePriceModalViewModel createOrUpdatePriceModalViewModel = new CreateOrUpdatePriceModalViewModel(await priceAppService.GetProductPriceForEdit(nullableIdInput));
            Product product = await this._productAppService.GetProduct(productId);

            createOrUpdatePriceModalViewModel.ProductIsCurrentlyActive = product.IsActive;
            List <SelectListItem> selectListItems   = new List <SelectListItem>();
            ITaxRuleAppService    taxRuleAppService = this._taxRuleAppService;
            int?tenantId = this.AbpSession.TenantId;
            ListResultDto <TaxRuleListDto> taxRulesByTenantId = await taxRuleAppService.GetTaxRulesByTenantId(tenantId.Value, true);

            if (!taxRulesByTenantId.Items.Any <TaxRuleListDto>())
            {
                this.ViewData["TaxRules"] = null;
            }
            else
            {
                foreach (TaxRuleListDto item in taxRulesByTenantId.Items)
                {
                    List <SelectListItem> selectListItems1 = selectListItems;
                    SelectListItem        selectListItem   = new SelectListItem()
                    {
                        Text     = item.Name,
                        Value    = item.Id.ToString(),
                        Selected = false
                    };
                    selectListItems1.Add(selectListItem);
                }
                this.ViewData["TaxRules"] = selectListItems.AsEnumerable <SelectListItem>();
            }
            return(this.PartialView("_CreateOrUpdatePriceModal", createOrUpdatePriceModalViewModel));
        }