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; } }
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); } }
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); } }
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); } }
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); } }
public void Remove(Author author) { context.Remove(author); }