public async Task <PartialViewResult> CreateOrEditModal(int?id) { GetDiseaseForEditOutput getDiseaseForEditOutput; if (id.HasValue) { getDiseaseForEditOutput = await _diseasesAppService.GetDiseaseForEdit(new EntityDto { Id = (int)id }); getDiseaseForEditOutput.Disease.Attachments = await _attachmentFilesAppService.GetAttacments(getDiseaseForEditOutput.Disease.PersonId + "." + id, AttachmentTypeConsts.DiagnoseTheDisease); } else { getDiseaseForEditOutput = new GetDiseaseForEditOutput { Disease = new CreateOrEditDiseaseDto() }; } var viewModel = new CreateOrEditDiseaseModalViewModel() { Disease = getDiseaseForEditOutput.Disease, Personname = getDiseaseForEditOutput.Personname, DiseasePersonList = await _diseasesAppService.GetAllPersonForTableDropdown(), AttachmentType = await _attachmentTypesAppService.GetAttachmentTypeById(AttachmentTypeConsts.DiagnoseTheDisease) }; return(PartialView("_CreateOrEditModal", viewModel)); }
public async Task <GetDiseaseForEditOutput> GetDiseaseForEdit(EntityDto input) { var disease = await _diseaseRepository.FirstOrDefaultAsync(input.Id); var output = new GetDiseaseForEditOutput { Disease = ObjectMapper.Map <CreateOrEditDiseaseDto>(disease) }; if (output.Disease.PersonId != null) { var _lookupPerson = await _lookup_personRepository.FirstOrDefaultAsync((int)output.Disease.PersonId); output.Personname = _lookupPerson?.name?.ToString(); } return(output); }