public async Task <PartialViewResult> CreateOrEditModal(int?id) { GetKkkkForEditOutput getKkkkForEditOutput; if (id.HasValue) { getKkkkForEditOutput = await _kkkksAppService.GetKkkkForEdit(new EntityDto { Id = (int)id }); getKkkkForEditOutput.Kkkk.Attachments = await _attachmentFilesAppService.GetAttacments(id + "", AttachmentTypeConsts.IDCardImageID); } else { getKkkkForEditOutput = new GetKkkkForEditOutput { Kkkk = new CreateOrEditKkkkDto() }; } var viewModel = new CreateOrEditKkkkModalViewModel() { Kkkk = getKkkkForEditOutput.Kkkk, Personname = getKkkkForEditOutput.Personname, KkkkPersonList = await _kkkksAppService.GetAllPersonForTableDropdown(), }; return(PartialView("_CreateOrEditModal", viewModel)); }
public async Task <GetKkkkForEditOutput> GetKkkkForEdit(EntityDto input) { var kkkk = await _kkkkRepository.FirstOrDefaultAsync(input.Id); var output = new GetKkkkForEditOutput { Kkkk = ObjectMapper.Map <CreateOrEditKkkkDto>(kkkk) }; if (output.Kkkk.PersonId != null) { var _lookupPerson = await _lookup_personRepository.FirstOrDefaultAsync((int)output.Kkkk.PersonId); output.Personname = _lookupPerson?.name?.ToString(); } return(output); }