/// <summary> /// /// </summary> /// <param name="id"></param> /// <param name="userId"></param> /// <returns></returns> public async Task <bool> RemoveItemFromCart(int id, string userId) { var item = await _context.ShoppingCarts.FirstOrDefaultAsync(x => x.Id == id && x.CreatedBy == userId); if (item != null) { _context.Remove(item); var deleted = await _context.SaveChangesAsync(); return(deleted > 0); } return(false); }