Exemplo n.º 1
0
        public async Task <GetVendorCategoryForEditOutput> GetVendorCategoryForEdit(EntityDto input)
        {
            var vendorCategory = await _vendorCategoryRepository.FirstOrDefaultAsync(input.Id);

            var output = new GetVendorCategoryForEditOutput {
                VendorCategory = ObjectMapper.Map <CreateOrEditVendorCategoryDto>(vendorCategory)
            };

            return(output);
        }
Exemplo n.º 2
0
        public async Task <PartialViewResult> CreateOrEditModal(int?id)
        {
            GetVendorCategoryForEditOutput getVendorCategoryForEditOutput;

            if (id.HasValue)
            {
                getVendorCategoryForEditOutput = await _vendorCategoriesAppService.GetVendorCategoryForEdit(new EntityDto { Id = (int)id });
            }
            else
            {
                getVendorCategoryForEditOutput = new GetVendorCategoryForEditOutput
                {
                    VendorCategory = new CreateOrEditVendorCategoryDto()
                };
            }

            var viewModel = new CreateOrEditVendorCategoryModalViewModel()
            {
                VendorCategory = getVendorCategoryForEditOutput.VendorCategory,
            };

            return(PartialView("_CreateOrEditModal", viewModel));
        }