示例#1
0
 public void DeleteItem(int id)
 {
     using (billGeneratorEntities1 entities = new billGeneratorEntities1())
     {
         entities.Products1.Remove(entities.Products1.FirstOrDefault(e => e.productId == id));
         entities.SaveChanges();
     }
 }
示例#2
0
 public void Post([FromUri] Product1 product1)
 {
     using (billGeneratorEntities1 entities = new billGeneratorEntities1())
     {
         entities.Products1.Add(product1);
         entities.SaveChanges();
     }
 }
示例#3
0
 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();
     }
 }
示例#5
0
        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()));
     }
 }
示例#7
0
        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()));
            }
        }
示例#8
0
 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());
     }
 }