Exemple #1
0
        public IHttpActionResult Post(Product item)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest();
            }

            _products.Add(item);
            return Created(item);
        }
        public static Product Product(Action<Product> config = null)
        {
            var retVal = new Product
            {
                Id = Any.Int(),
                Category = Any.AlphanumericString(),
                Price = Any.Decimal(),
                Name = Any.CompanyName(),
                Comment = Any.Description()
            };

            if (config != null) config(retVal);

            return retVal;
        }
Exemple #3
0
 public IQueryable<Product> RelatedProducts(Product supplier, DateTimeOffset start, DateTimeOffset end)
 {
     return _productAgent.RelatedProducts().AsQueryable();
 }