// POST api/inventory
 public HttpResponseMessage Post(inventory Item)
 {
     InventoryRepository.save(ref Item);
     var response = Request.CreateResponse(HttpStatusCode.Created, Item);
     string url = Url.Link("DefaultApi", new { Item.id });
     response.Headers.Location = new Uri(url);
     return response;
 }
示例#2
0
        internal static void InsertItem(inventory Item)
        {
            // create our NHibernate session factory
            var sessionFactory = FluentNHibernate.CreateSessionFactory();

            using (var session = sessionFactory.OpenSession())
            {

                // retreive all stores and display them
                using (var transaction = session.BeginTransaction())
                {

                    session.SaveOrUpdate(Item);

                    transaction.Commit();

                }

            }
        }
示例#3
0
        public static void save(ref inventory Item)
        {
            // create our NHibernate session factory
            var sessionFactory = FluentNHibernate.CreateSessionFactory();

            using (var session = sessionFactory.OpenSession())
            {
                // retreive all stores and display them
                using (session.BeginTransaction())
                {

                    session.Save(Item);

                    session.Transaction.Commit();

                }

            }
        }