public static async Task <ServiceEnvironmentStatus> GetServiceEnvironmentStatusAsync(this ServiceMonitorDbContext dbContext, ServiceEnvironmentStatus entity) => await dbContext.ServiceEnvironmentStatuses.FirstOrDefaultAsync(item => item.ID == entity.ID);
public static async Task <User> GetUserAsync(this ServiceMonitorDbContext dbContext, string userName) => await dbContext.Users.FirstOrDefaultAsync(item => item.UserName == userName);
public static IQueryable <ServiceUser> GetServiceUserByUserID(this ServiceMonitorDbContext dbContext, int?userID) => dbContext.ServiceUsers.Where(item => item.UserID == userID);
public static IQueryable <ServiceWatcherItemDto> GetActiveServiceWatcherItems(this ServiceMonitorDbContext dbContext) { return(from serviceEnvironment in dbContext.ServiceEnvironments join service in dbContext.Services on serviceEnvironment.ServiceID equals service.ID join serviceWatcher in dbContext.ServiceWatchers on serviceEnvironment.ServiceID equals serviceWatcher.ServiceID join environmentCategory in dbContext.EnvironmentCategories on serviceEnvironment.EnvironmentCategoryID equals environmentCategory.ID select new ServiceWatcherItemDto { ServiceEnvironmentID = serviceEnvironment.ID, ServiceID = service.ID, Environment = environmentCategory.Name, ServiceName = service.Name, Interval = serviceEnvironment.Interval, Url = serviceEnvironment.Url, Address = serviceEnvironment.Address, ConnectionString = serviceEnvironment.ConnectionString, TypeName = serviceWatcher.TypeName }); }