public static CurrentDayRoute GetOneCDR(int? cdrkey) { // original return (CurrentDayRoute.All().Where(x => (x.CurrentDayRouteID == cdrkey))).FirstOrDefault(); var name = "GetOneCDR(int? cdrkey)"; if (cdrkey.HasValue) { return (CurrentDayRoute.Find(x => x.CurrentDayRouteID == cdrkey).First()); } else { CurrentDayRoute cdr = CurrentDayRoute.Find(x => x.CurrentDayRouteID == cdrkey.Value).DefaultIfEmpty( new CurrentDayRoute { CDRRouteID = "xx", CDRRouteName = name, DUser = "******", Terminal = "not allowed" }).First(); return cdr; } }
public static int GetCDRCount() { return CurrentDayRoute.All().Count(); }
public static CurrentDayRoute GetRouteWithKey(int? key) { var first = CurrentDayRoute.Find(x => x.CurrentDayRouteID == key).FirstOrDefault() ?? new CurrentDayRoute { CurrentDayRouteID = 500, CDRDriverLastName = "invalid route" }; return first; }
public static CurrentDayRoute GetCDRWithRouteID(string tag) { return (from r in CurrentDayRoute.All() where (r.CDRRouteID == tag) select r).FirstOrDefault(); }