/// <summary> /// Gets a single piece of pixel art from the database. /// </summary> public static async Task <PixelArt> GetSinglePixelAsync(int id, PixelDBContext _context) { //get pixel art with corrosponding id return(await(from pixel in _context.PixelArts where pixel.PixelArtID == id select pixel).SingleAsync()); //gets a single item from the database }
/// <summary> /// Gets a page of pixel arts from the database. /// </summary> public async static Task <List <PixelArt> > GetPageOfPixelsAsync(PixelDBContext _context, int PageSize, int pageNum) { List <PixelArt> pixelArts = await(_context.PixelArts.OrderBy(p => p.DateCreated)).Skip(PageSize * (pageNum - 1)) // Skip() must be before Take() .Take(PageSize) .ToListAsync(); return(pixelArts); }
public GalleryController(PixelDBContext context, IConfiguration config, BlobStorageHelper blobHelper) { _context = context; _BlobHelper = blobHelper; }
//Gets all commissions from the database. public async static Task <int> GetTotalCommissionsAsync(PixelDBContext _context) { return(await(from c in _context.Commissions select c).CountAsync()); }
public async static Task <CommissionsLog> GetSingleCommissionAsync(int id, PixelDBContext _context) { return(await(from commission in _context.Commissions where commission.ComissionID == id select commission).SingleAsync()); }
public async static Task <List <CommissionsLog> > GetPageOfCommissionsAsync(PixelDBContext _context, int pageSize, int pageNum) { List <CommissionsLog> commissionsLogs = await(_context.Commissions.OrderBy(c => c.DateCompleted)).Skip(pageSize * (pageNum - 1)).Take(pageSize).ToListAsync(); return(commissionsLogs); }
/// <summary> /// Gets all pixels from the database. /// </summary> public async static Task <int> GetTotalPixelsAsync(PixelDBContext _context) { return(await(from p in _context.PixelArts select p).CountAsync()); }
public CommissionsController(PixelDBContext context, IConfiguration config) { _context = context; }