public void DeleteItem(int id) { using (billGeneratorEntities1 entities = new billGeneratorEntities1()) { entities.Products1.Remove(entities.Products1.FirstOrDefault(e => e.productId == id)); entities.SaveChanges(); } }
public void Post([FromUri] Product1 product1) { using (billGeneratorEntities1 entities = new billGeneratorEntities1()) { entities.Products1.Add(product1); entities.SaveChanges(); } }
public void Delete() { using (billGeneratorEntities1 entities = new billGeneratorEntities1()) { entities.Products1.RemoveRange(entities.Products1); entities.SaveChanges(); } }
public void PostUserDetails([FromUri] UserDetail userDetail) { using (billGeneratorEntities1 entities = new billGeneratorEntities1()) { entities.UserDetails.Add(userDetail); entities.SaveChanges(); } }
public IHttpActionResult Get() { using (billGeneratorEntities1 entities = new billGeneratorEntities1()) { return(Ok((from b in entities.products select b).ToList())); } }
public IHttpActionResult GetUserDetails([FromUri] int id) { using (billGeneratorEntities1 entities = new billGeneratorEntities1()) { return(Ok((from b in entities.UserDetails where b.UserID == id select b).ToList())); } }
public IHttpActionResult GetUpdate([FromUri] int id) { using (billGeneratorEntities1 entities = new billGeneratorEntities1()) { return(Ok((from b in entities.Products1 where b.productId == id select b).ToList())); } }
public IHttpActionResult UpdateItems(int id, [FromUri] Product1 product) { using (billGeneratorEntities1 entities = new billGeneratorEntities1()) { 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()); } }