public ExecuteResultEntity <ICollection <TicketPeriod> > QueryAll() { try { TicketPeriodRepository repo = RepositoryHelper.GetTicketPeriodRepository(); database = repo.UnitOfWork; var queryresult = from q in repo.All() orderby q.DayLimit ascending select q; return(ExecuteResultEntity <ICollection <TicketPeriod> > .CreateResultEntity( new Collection <TicketPeriod>(queryresult.ToList()))); } catch (Exception ex) { return(ExecuteResultEntity <ICollection <TicketPeriod> > .CreateErrorResultEntity(ex)); } }
public Task <ExecuteResultEntity <ICollection <TicketPeriod> > > QueryForSelectBusinessItemAsync(Guid MaterialCategoriesId, string BusinessItem, Guid ManufacturersId) { try { TicketPeriodRepository repo = RepositoryHelper.GetTicketPeriodRepository(); database = repo.UnitOfWork; var queryresult = from q in repo.All() from b in q.ManufacturersBussinessItems where b.MaterialCategoriesId == MaterialCategoriesId && b.Name.Contains(BusinessItem) && b.ManufacturersId == ManufacturersId orderby q.DayLimit ascending select q; return(Task.FromResult(ExecuteResultEntity <ICollection <TicketPeriod> > .CreateResultEntity( new Collection <TicketPeriod>(queryresult.Distinct().ToList())))); } catch (Exception ex) { return(Task.FromResult(ExecuteResultEntity <ICollection <TicketPeriod> > .CreateErrorResultEntity(ex))); throw; } }