public async Task <GetAttachmentTypeForEditOutput> GetAttachmentTypeForEdit(EntityDto input) { var attachmentType = await _attachmentTypeRepository.FirstOrDefaultAsync(input.Id); var output = new GetAttachmentTypeForEditOutput { AttachmentType = ObjectMapper.Map <CreateOrEditAttachmentTypeDto>(attachmentType) }; if (output.AttachmentType.EntityTypeId != null) { var _lookupAttachmentEntityType = await _lookup_attachmentEntityTypeRepository.FirstOrDefaultAsync((int)output.AttachmentType.EntityTypeId); output.AttachmentEntityTypeArName = _lookupAttachmentEntityType?.ArName?.ToString(); } return(output); }
public async Task <PartialViewResult> CreateOrEditModal(int?id) { GetAttachmentTypeForEditOutput getAttachmentTypeForEditOutput; if (id.HasValue) { getAttachmentTypeForEditOutput = await _attachmentTypesAppService.GetAttachmentTypeForEdit(new EntityDto { Id = (int)id }); } else { getAttachmentTypeForEditOutput = new GetAttachmentTypeForEditOutput { AttachmentType = new CreateOrEditAttachmentTypeDto() }; } var viewModel = new CreateOrEditAttachmentTypeModalViewModel() { AttachmentType = getAttachmentTypeForEditOutput.AttachmentType, AttachmentEntityTypeArName = getAttachmentTypeForEditOutput.AttachmentEntityTypeArName, AttachmentTypeAttachmentEntityTypeList = await _attachmentTypesAppService.GetAllAttachmentEntityTypeForTableDropdown(), }; return(PartialView("_CreateOrEditModal", viewModel)); }