public async Task <ProjectSubSearchModel> GetProjectByHolidayIdAsync(int holidayId) { var holiday = await _context.Holidays.Include(h => h.Project) .Where(h => h.HolidayId == holidayId).FirstOrDefaultAsync(); var project = holiday == null ? null : holiday.Project; var projectSearch = ProjectOperator.SetProjectSubSearchModel(project); return(projectSearch); }
public async Task <ProjectSubSearchModel> GetProjectByGroupIdAsync(int groupId) { var group = await _context.Groups .Include(g => g.Project) .Where(g => g.GroupId == groupId).FirstOrDefaultAsync(); var project = group == null ? null : group.Project; var projectSearch = ProjectOperator.SetProjectSubSearchModel(project); return(projectSearch); }
public async Task <ProjectSubSearchModel> GetProjectByLocationIdAsync(int locationId) { var location = await _context.Locations .Include(l => l.Project) .Where(l => l.LocationId == locationId).FirstOrDefaultAsync(); var project = location == null ? null : location.Project; var projectSearch = ProjectOperator.SetProjectSubSearchModel(project); return(projectSearch); }
public async Task <ProjectSubSearchModel> GetProjectBySceneIdAsync(int sceneId) { var scenes = await _context.Scenes .Include(s => s.Project).Where(s => s.SceneId == sceneId) .FirstOrDefaultAsync(); var project = scenes == null ? null : scenes.Project; var projectSearch = ProjectOperator.SetProjectSubSearchModel(project); return(projectSearch); }
public async Task <IEnumerable <ProjectSubSearchModel> > GetProjectsByCustomerIdAsync(int customerId) { var queryData = _context.Projects .Where(v => v.CustomerId == customerId); var result = QueryOperate <Project> .Execute(queryData); var projects = await result.ToListAsync(); var projectSearch = ProjectOperator.SetProjectSubSearchModel(projects); return(projectSearch); }