public List<GR_Ambulances> GetAmbulances(bool IsActiveOnly) { using (var data = new AmbulanceEntities()) { var query = data.GR_Ambulances.Select(a => a); if (IsActiveOnly == true) { query = query.Where(a => a.IsActive == true); } return query.OrderBy(a => a.RegNumber).ToList(); } }
public List<HR_GlobalPositions> GetGlobalPositions(bool IsActiveOnly) { using (var data = new AmbulanceEntities()) { var query = data.HR_GlobalPositions.Select(a => a); if (IsActiveOnly == true) { query = query.Where(a => a.IsActive == true); } return query.OrderBy(a => a.Name).ToList(); } }
public BaseLogic() { _databaseContext = new AmbulanceEntities(); //_databaseContext.Database.Connection.ConnectionString = cs; }
public List<StructurePositionViewModel> GetStructurePositions(int id_department, bool IsActiveOnly) { using (var data = new AmbulanceEntities()) { var query = data.HR_StructurePositions.Where(a => a.id_department == id_department); if (IsActiveOnly == true) { query = query.Where(a => a.IsActive == true); } var result = query.OrderBy(a => a.Order).ToList(); var result2 = result .Select(a => new StructurePositionViewModel { Code = a.Code, GlobalPositionName = a.HR_GlobalPositions.Name, id_department = a.id_department, id_structurePosition = a.id_structurePosition, PositionType = a.HR_GlobalPositions.NM_PositionTypes.Name, StaffCount = a.StaffCount.ToString(), Order = a.Order }).ToList(); return result2; } }