private async Task <TenantSettings> CreateTenantSettings(SaveTenantSettingsData model) { var settingsEntity = _mapper.Map <TenantSettingsEntity>(model); _context.TenantSettings.Add(settingsEntity); await _context.SaveChangesAsync(); return(_mapper.Map <TenantSettings>(settingsEntity)); }
public async Task <TenantSettings> SaveTenantSettings(SaveTenantSettingsData model) { try { var tenantSettings = await GetTenantSettings(model.TenantId); if (tenantSettings == null) { return(await CreateTenantSettings(model)); } return(await UpdateTenantSettings(tenantSettings, model)); } catch (Exception e) { _logger.LogError(e, e.Message); return(null); } }
private async Task <TenantSettings> UpdateTenantSettings(TenantSettingsEntity entity, SaveTenantSettingsData model) { _mapper.Map(model, entity); await _context.SaveChangesAsync(); return(_mapper.Map <TenantSettings>(entity)); }