public async Task <ActionResult <IList <JobStatus> > > GetAllStatues() { var tenant = (await _tenantService.GetTenantFromHostAsync()); if (tenant != null) { Console.WriteLine($"getting status for {tenant.Id} : {tenant.Name}"); using (var context = _tenantService.CreateContext(tenant)) { var jobExtrasService = new JobExtrasService(context); return(Ok(await jobExtrasService.GetAllJobStatues())); } } 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 })); } }