public async Task <GetAttachmentEntityTypeForEditOutput> GetAttachmentEntityTypeForEdit(EntityDto input) { var attachmentEntityType = await _attachmentEntityTypeRepository.FirstOrDefaultAsync(input.Id); var output = new GetAttachmentEntityTypeForEditOutput { AttachmentEntityType = ObjectMapper.Map <CreateOrEditAttachmentEntityTypeDto>(attachmentEntityType) }; if (output.AttachmentEntityType.ParentTypeId != null) { var _lookupAttachmentEntityType = await _lookup_attachmentEntityTypeRepository.FirstOrDefaultAsync((int)output.AttachmentEntityType.ParentTypeId); output.AttachmentEntityTypeArName = _lookupAttachmentEntityType?.ArName?.ToString(); } return(output); }
public async Task <PartialViewResult> CreateOrEditModal(int?id) { GetAttachmentEntityTypeForEditOutput getAttachmentEntityTypeForEditOutput; if (id.HasValue) { getAttachmentEntityTypeForEditOutput = await _attachmentEntityTypesAppService.GetAttachmentEntityTypeForEdit(new EntityDto { Id = (int)id }); } else { getAttachmentEntityTypeForEditOutput = new GetAttachmentEntityTypeForEditOutput { AttachmentEntityType = new CreateOrEditAttachmentEntityTypeDto() }; } var viewModel = new CreateOrEditAttachmentEntityTypeModalViewModel() { AttachmentEntityType = getAttachmentEntityTypeForEditOutput.AttachmentEntityType, AttachmentEntityTypeArName = getAttachmentEntityTypeForEditOutput.AttachmentEntityTypeArName, }; return(PartialView("_CreateOrEditModal", viewModel)); }