public IEnumerable <Project> GetAll() { var projects = context_.Set <Project>() .Include(u => u.UserCreator) .Include(fd => fd.FundingPackages).ToList(); projects.ForEach(p => p.Description = ExtraMethod.ConvertToRawHtml(p.Description)); return(projects); }
public Photo UpdatePhoto(UpdatePhotoOptions options) { if (options == null) { return(null); } var queryPhoto = context_ .Set <Photo>() .AsQueryable() .Where(p => p.ID == options.PhotoId); if (queryPhoto != null) { var photo = new Photo() { Name = options.Name, Path = options.Path }; return(photo); } return(null); }
public IQueryable <Status> SearchStatus(SearchStatusOptions options) { if (options == null) { return(null); } var query = context_ .Set <Status>() .AsQueryable(); if (!string.IsNullOrWhiteSpace(options.Description)) { query = query.Where(st => st.Description == options.Description); } if (options.StatusId != null) { query = query.Where(st => st.StatusId == options.StatusId); } if (options.DateCreatedFrom != null) { query = query.Where(st => st.DateCreated >= options.DateCreatedFrom); } if (options.DateCreatedTo != null) { query = query.Where(st => st.DateCreated <= options.DateCreatedTo); } query = query.Take(500); return(query); }
public Video UpdateVideo(UpdateVideoOptions options) { if (options == null) { return(null); } var queryVideo = context_ .Set <Video>() .AsQueryable() .Where(v => v.ID == options.VideoId); if (queryVideo != null) { var video = new Video() { Name = options.Name, Path = options.Path }; return(video); } return(null); }
public IQueryable <ApplicationUser> Search(SearchUserOptions options) { if (options == null) { return(null); } var query = context_ .Set <ApplicationUser>() .AsQueryable(); if (!string.IsNullOrWhiteSpace(options.FirstName)) { query = query.Where(u => u.FirstName == options.FirstName); } if (!string.IsNullOrWhiteSpace(options.LastName)) { query = query.Where(u => u.LastName == options.LastName); } if (!string.IsNullOrWhiteSpace(options.UserName)) { query = query.Where(u => u.UserName == options.UserName); } if (options.DateOfBirthFrom != null) { query = query.Where(u => u.DateOfBirth >= options.DateOfBirthFrom); } if (options.DateOfBirthTo != null) { query = query.Where(u => u.DateOfBirth <= options.DateOfBirthTo); } query = query.Take(500); return(query); }
public IQueryable<FundingPackage> SearchFundingPackage(SearchFundingPackageOptions options) { if (options == null) { return null; } var query = context_ .Set<FundingPackage>() .AsQueryable(); if (!string.IsNullOrWhiteSpace(options.Name)) { query = query.Where(fp => fp.Name == options.Name); } if (!string.IsNullOrWhiteSpace(options.Description)) { query = query.Where(fp => fp.Name == options.Name); } if (options.FundingPackageId != null) { query = query.Where(fp => fp.FundingPackageId == options.FundingPackageId.Value); } if (options.PriceFrom != null) { query = query.Where(fp => fp.Price >= options.PriceFrom); } if (options.PriceTo != null) { query = query.Where(fp => fp.Price <= options.PriceTo); } query = query.Take(500); return query; }