public bool DeleteCartItem(console.Models.tbl_CartItem entity) { bool result = false; using (var context = new console.Models.dream_techContext()) { context.tbl_CartItem.Remove(entity); result = context.SaveChanges() > 1; } return(result); }
public bool UpdateCartItem(console.Models.tbl_CartItem entity) { bool result = false; using (var context = new console.Models.dream_techContext()) { tbl_CartItem cartItem = (from u in context.tbl_CartItem where (u.cart_ref == entity.cart_ref) where (u.product_id == entity.product_id) select u).First(); cartItem.cart_ref = entity.cart_ref; cartItem.product_id = entity.product_id; cartItem.quantity = entity.quantity; result = context.SaveChanges() > 1; } return(result); }