Esempio n. 1
0
 public async Task<List<Purchase>> GetAll(BuyStatus buyStatus = BuyStatus.AwaitingPayment)
 {
     return await _context.Purchases
         .Include(x=>x.Book.Autor)
         .Where(x => x.BuyStatus == buyStatus)
         .OrderBy(x=>x.Book.Title)
         .ToListAsync();
 }
Esempio n. 2
0
        public async Task <IActionResult> Delete(BuyStatus buyStatus = BuyStatus.AwaitingPayment)
        {
            await purchasesService.Delete(buyStatus);

            return(RedirectToAction(buyStatus == BuyStatus.Bought ? nameof(Index) : nameof(RefundedIndex)));
        }
Esempio n. 3
0
 public async Task Delete(BuyStatus buyStatus)
 {
     var purchases = await GetAll(buyStatus);
     _context.Purchases.RemoveRange(purchases);
     await _context.SaveChangesAsync();
 }