Esempio n. 1
0
        public object Get(Product request)
        {
            if (request.Id != default(long))
                return Db.GetById<Product>(request.Id);

            return Db.Select<Product>();
        }
Esempio n. 2
0
        public object Post(Product product)
        {
            Db.Save(product);
            product.Id = (int)Db.GetLastInsertId();

            var pathToNewResource = base.RequestContext.AbsoluteUri.CombineWith(product.Id.ToString());
            return HttpResult.Status201Created(product, pathToNewResource);
        }
Esempio n. 3
0
 public Product Put(Product product)
 {
     Db.Save(product);
     return product;
 }
Esempio n. 4
0
 public void Delete(Product request)
 {
     Db.DeleteById<Product>(request.Id);
 }