public static OnlineServiceInfo GetOnlineServiceInfo(int ServiceId) { IList <OnlineServiceInfo> source = new OnlineServiceDao().Gets <OnlineServiceInfo>("OrderId", SortAction.Asc, null); if (ServiceId > 0) { return(source.FirstOrDefault((OnlineServiceInfo t) => t.Id == ServiceId)); } return((from t in source orderby t.OrderId, t.Id select t).FirstOrDefault()); }
public static IList <OnlineServiceInfo> GetAllOnlineService(int ServiceType = 0, int Status = -1) { IQueryable <OnlineServiceInfo> source = new OnlineServiceDao().Gets <OnlineServiceInfo>("OrderId", SortAction.Desc, null).AsQueryable(); if (ServiceType > 0) { source = from t in source where t.ServiceType == ServiceType select t; } if (Status >= 0) { source = from t in source where t.Status == Status select t; } return(source.ToList()); }