private async Task <TenantLogosEditDto> GetTenantLogo(int tenantId) { TenantLogosEditDto tenantLogosEditDto; IRepository <TenantLogos, long> repository = this._tenantLogosRepository; TenantLogos tenantLogo = await repository.FirstOrDefaultAsync((TenantLogos m) => m.TenantId == tenantId); TenantLogos tenantLogo1 = tenantLogo; if (tenantLogo1 == null) { tenantLogosEditDto = new TenantLogosEditDto() { TenantId = tenantId }; } else { TenantLogosEditDto tenantLogosEditDto1 = new TenantLogosEditDto() { TenantId = tenantId, HeaderImageId = tenantLogo1.HeaderImageId, HeaderMobileImageId = tenantLogo1.HeaderMobileImageId, MailImageId = tenantLogo1.MailImageId, InvoiceImageId = tenantLogo1.InvoiceImageId }; tenantLogosEditDto = tenantLogosEditDto1; } return(tenantLogosEditDto); }
public async Task UpdateTenantLogos(TenantLogosEditDto input) { Guid?headerImageId; IRepository <TenantLogos, long> repository = this._tenantLogosRepository; TenantLogos tenantLogo = await repository.FirstOrDefaultAsync((TenantLogos m) => m.TenantId == input.TenantId); TenantLogos headerMobileImageId = tenantLogo; if (headerMobileImageId == null) { headerMobileImageId = new TenantLogos() { TenantId = input.TenantId }; headerImageId = input.HeaderImageId; if (!headerImageId.HasValue) { headerImageId = null; headerMobileImageId.HeaderImageId = headerImageId; } else { headerMobileImageId.HeaderImageId = input.HeaderImageId; } headerImageId = input.HeaderMobileImageId; if (!headerImageId.HasValue) { headerImageId = null; headerMobileImageId.HeaderMobileImageId = headerImageId; } else { headerMobileImageId.HeaderMobileImageId = input.HeaderMobileImageId; } headerImageId = input.MailImageId; if (!headerImageId.HasValue) { headerImageId = null; headerMobileImageId.MailImageId = headerImageId; } else { headerMobileImageId.MailImageId = input.MailImageId; } headerImageId = input.InvoiceImageId; if (!headerImageId.HasValue) { headerImageId = null; headerMobileImageId.InvoiceImageId = headerImageId; } else { headerMobileImageId.InvoiceImageId = input.InvoiceImageId; } } else { headerMobileImageId.TenantId = input.TenantId; headerImageId = input.HeaderImageId; if (!headerImageId.HasValue) { headerImageId = null; headerMobileImageId.HeaderImageId = headerImageId; } else { headerMobileImageId.HeaderImageId = input.HeaderImageId; } headerImageId = input.HeaderMobileImageId; if (!headerImageId.HasValue) { headerImageId = null; headerMobileImageId.HeaderMobileImageId = headerImageId; } else { headerMobileImageId.HeaderMobileImageId = input.HeaderMobileImageId; } headerImageId = input.MailImageId; if (!headerImageId.HasValue) { headerImageId = null; headerMobileImageId.MailImageId = headerImageId; } else { headerMobileImageId.MailImageId = input.MailImageId; } headerImageId = input.InvoiceImageId; if (!headerImageId.HasValue) { headerImageId = null; headerMobileImageId.InvoiceImageId = headerImageId; } else { headerMobileImageId.InvoiceImageId = input.InvoiceImageId; } } await this._tenantLogosRepository.InsertOrUpdateAndGetIdAsync(headerMobileImageId); }