public ShiftInfoModel GetShiftInfo(ShiftSearchModel searchModel) { ShiftInfoModel info = new ShiftInfoModel(); DataContext dc = new DataContext(this.DbString); IShiftRepository rep = new ShiftRepository(dc); IQueryable <Shift> results = rep.Search(searchModel); info.shiftCount = dc.Context.GetTable <Shift>().Where(c => c.id.Equals(results.Count() > 0 ? results.First().id : -1)).Count(); return(info); }