public bool DeleteProduct(console.Models.tblProduct entity) { bool result = false; using (var context = new console.Models.dream_techContext()) { context.tblProducts.Remove(entity); result = context.SaveChanges() > 1; } return(result); }
public bool UpdateProduct(console.Models.tblProduct entity) { bool result = false; using (var context = new console.Models.dream_techContext()) { tblProduct product = (from p in context.tblProducts where p.product_id == entity.product_id select p).First(); product.name = entity.name; product.description = entity.description; product.units = entity.units; product.categoty_id = entity.categoty_id; product.price_id = entity.price_id; product.type_id = entity.type_id; result = context.SaveChanges() > 1; } return(result); }