public async Task <PartialViewResult> CreateOrEditModal(long?id) { GetAttachmentFileForEditOutput getAttachmentFileForEditOutput; if (id.HasValue) { getAttachmentFileForEditOutput = await _attachmentFilesAppService.GetAttachmentFileForEdit(new EntityDto <long> { Id = (long)id }); } else { getAttachmentFileForEditOutput = new GetAttachmentFileForEditOutput { AttachmentFile = new CreateOrEditAttachmentFileDto() }; } var viewModel = new CreateOrEditAttachmentFileModalViewModel() { AttachmentFile = getAttachmentFileForEditOutput.AttachmentFile, AttachmentTypeArName = getAttachmentFileForEditOutput.AttachmentTypeArName, AttachmentFileAttachmentTypeList = await _attachmentFilesAppService.GetAllAttachmentTypeForTableDropdown(), }; return(PartialView("_CreateOrEditModal", viewModel)); }
public async Task <GetAttachmentFileForEditOutput> GetAttachmentFileForEdit(EntityDto <long> input) { var attachmentFile = await _attachmentFileRepository.FirstOrDefaultAsync(input.Id); var output = new GetAttachmentFileForEditOutput { AttachmentFile = ObjectMapper.Map <CreateOrEditAttachmentFileDto>(attachmentFile) }; if (output.AttachmentFile.AttachmentTypeId != null) { var _lookupAttachmentType = await _lookup_attachmentTypeRepository.FirstOrDefaultAsync((int)output.AttachmentFile.AttachmentTypeId); output.AttachmentTypeArName = _lookupAttachmentType?.ArName?.ToString(); } return(output); }