コード例 #1
0
 public void DeleteItem([FromUri] int id)
 {
     using (billGeneratorEntities entities = new billGeneratorEntities())
     {
         entities.Products1.Remove(entities.Products1.FirstOrDefault(e => e.productId == id));
         entities.SaveChanges();
     }
 }
コード例 #2
0
 public void Delete()
 {
     using (billGeneratorEntities entities = new billGeneratorEntities())
     {
         entities.Products1.RemoveRange(entities.Products1);
         entities.SaveChanges();
     }
 }
コード例 #3
0
 public void PostUserDetails([FromUri] UserDetail userDetail)
 {
     using (billGeneratorEntities entities = new billGeneratorEntities())
     {
         entities.UserDetails.Add(userDetail);
         entities.SaveChanges();
     }
 }
コード例 #4
0
 public void Post([FromUri] Product1 product1)
 {
     using (billGeneratorEntities entities = new billGeneratorEntities())
     {
         entities.Products1.Add(product1);
         entities.SaveChanges();
     }
 }
コード例 #5
0
 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());
     }
 }