public async Task <ActionResult <IList <JobType> > > GetAllTypes() { var tenant = (await _tenantService.GetTenantFromHostAsync()); if (tenant != null) { Console.WriteLine($"getting type for {tenant.Id} : {tenant.Name}"); using (var context = _tenantService.CreateContext(tenant)) { var jobExtrasService = new JobExtrasService(context); return(Ok(await jobExtrasService.GetAllJobTypes())); } } return(BadRequest("Tenant doesn't exist")); }
public async Task <ActionResult <TenantViewModelWithExtras> > Get() { var tenant = await _tenantService.GetTenantFromHostAsync(); if (tenant == null) { return(BadRequest()); } if (tenant.Name == _appSettings.BaseHost) { return(Ok()); } using (var context = _tenantService.CreateContext(tenant)) { var jobExtrasService = new JobExtrasService(context); var statues = await jobExtrasService.GetAllJobStatues(); var types = await jobExtrasService.GetAllJobTypes(); var priorities = await jobExtrasService.GetAllJobPriorities(); return(Ok(new TenantViewModelWithExtras() { Id = tenant.Id, Name = tenant.Name, Accent = tenant.Accent, Avatar = tenant.Avatar, Description = tenant.Description, JobPriorities = priorities, JobStatuses = statues, JobTypes = types })); } }