Ejemplo n.º 1
0
        public async Task <PartialViewResult> CreateOrEditModal(int?id)
        {
            GetVendorForEditOutput getVendorForEditOutput;

            if (id.HasValue)
            {
                getVendorForEditOutput = await _vendorsAppService.GetVendorForEdit(new EntityDto { Id = (int)id });
            }
            else
            {
                getVendorForEditOutput = new GetVendorForEditOutput
                {
                    Vendor = new CreateOrEditVendorDto()
                };
            }

            var viewModel = new CreateOrEditVendorModalViewModel()
            {
                Vendor                   = getVendorForEditOutput.Vendor,
                VendorCategoryName       = getVendorForEditOutput.VendorCategoryName,
                VendorVendorCategoryList = await _vendorsAppService.GetAllVendorCategoryForTableDropdown(),
            };

            return(PartialView("_CreateOrEditModal", viewModel));
        }
Ejemplo n.º 2
0
        public async Task <GetVendorForEditOutput> GetVendorForEdit(EntityDto input)
        {
            var vendor = await _vendorRepository.FirstOrDefaultAsync(input.Id);

            var output = new GetVendorForEditOutput {
                Vendor = ObjectMapper.Map <CreateOrEditVendorDto>(vendor)
            };

            if (output.Vendor.VendorCategoryId != null)
            {
                var _lookupVendorCategory = await _lookup_vendorCategoryRepository.FirstOrDefaultAsync((int)output.Vendor.VendorCategoryId);

                output.VendorCategoryName = _lookupVendorCategory?.Name?.ToString();
            }

            return(output);
        }
Ejemplo n.º 3
0
        public async Task <GetVendorForEditOutput> GetVendorForEdit(EntityDto input)
        {
            var vendor = await _vendorRepository.FirstOrDefaultAsync(input.Id);

            var output = new GetVendorForEditOutput {
                Vendor = ObjectMapper.Map <CreateOrEditVendorDto>(vendor)
            };

            if (output.Vendor.SsicCodeId != null)
            {
                var _lookupSsicCode = await _lookup_ssicCodeRepository.FirstOrDefaultAsync((int)output.Vendor.SsicCodeId);

                output.SsicCodeCode = _lookupSsicCode.Code.ToString();
            }

            if (output.Vendor != null)
            {
                var _lookupCurrency = await _lookup_currencyRepository.FirstOrDefaultAsync((int)output.Vendor.CurrencyId);

                output.CurrencyCode = _lookupCurrency.Code.ToString();
            }

            return(output);
        }