public void DeleteItem([FromUri] int id) { using (billGeneratorEntities entities = new billGeneratorEntities()) { entities.Products1.Remove(entities.Products1.FirstOrDefault(e => e.productId == id)); entities.SaveChanges(); } }
public void Delete() { using (billGeneratorEntities entities = new billGeneratorEntities()) { entities.Products1.RemoveRange(entities.Products1); entities.SaveChanges(); } }
public void PostUserDetails([FromUri] UserDetail userDetail) { using (billGeneratorEntities entities = new billGeneratorEntities()) { entities.UserDetails.Add(userDetail); entities.SaveChanges(); } }
public void Post([FromUri] Product1 product1) { using (billGeneratorEntities entities = new billGeneratorEntities()) { entities.Products1.Add(product1); entities.SaveChanges(); } }
public IHttpActionResult UpdateItems(int id, [FromUri] Product1 product) { using (billGeneratorEntities entities = new billGeneratorEntities()) { var entity = entities.Products1.FirstOrDefault(e => e.productId == id); entity.ProductName = product.ProductName; entity.Price = product.Price; entity.quantity = product.quantity; entity.total = product.total; entities.SaveChanges(); return(Ok()); } }