Exemplo n.º 1
0
        public async Task <bool> DeleteCartItem(IEnumerable <CartItemForDeleteDto> bookIds, string applicationuserId)
        {
            try
            {
                if (bookIds != null)
                {
                    foreach (var item in bookIds)
                    {
                        var cartItemInDB = await _dbContext.CartItems
                                           .FirstOrDefaultAsync(x => x.BookID == item.BookId && x.ApplicationUserId == applicationuserId);

                        if (cartItemInDB == null)
                        {
                            continue;
                        }
                        _dbContext.Remove(cartItemInDB);
                    }
                }
                await _dbContext.SaveChangesAsync();

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
 public bool Delete(Section item)
 {
     try
     {
         var section = Get(item.Id);
         if (section != null)
         {
             _context.Remove(section);
             _context.SaveChanges();
             return(true);
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 3
0
 public bool Delete(Order item)
 {
     try
     {
         var order = Get(item.Id);
         if (order != null)
         {
             _context.Remove(order);
             _context.SaveChanges();
             return(true);
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 4
0
 public bool Delete(Carousel item)
 {
     try
     {
         var carousel = Get(item.Id);
         if (carousel != null)
         {
             _context.Remove(carousel);
             _context.SaveChanges();
             return(true);
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 5
0
 public bool Delete(Book item)
 {
     try
     {
         var book = Get(item.Id);
         if (book != null)
         {
             _context.Remove(book);
             _context.SaveChanges();
             return(true);
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 6
0
 public void Remove(Author author)
 {
     context.Remove(author);
 }