Exemple #1
0
        public IHttpActionResult ProductDetails(int id)
        {
            DateTime now             = DateTime.Now;
            AlltOchMerDataContext db = new AlltOchMerDataContext("AlltOchMerDbConnectionString");
            var product = from p in db.Products
                          join price in db.ProductPriceLists
                          on p.Id equals price.ProductId

                          join pl in db.PriceLists
                          on price.PriceListId equals pl.Id

                          join description in db.ProductDescriptions
                          on p.Id equals description.ProductId

                          where p.Id == id
                          where description.LanguageId == 1
                          where pl.ValidFrom >= now

                          select p;

            return(Ok(product));

            //if (product == null)
            //    return NotFound();
            //return Ok(product);
        }
Exemple #2
0
        public ProductController()
        {
            var alltOchMerDataContext = new AlltOchMerDataContext("AlltOchMerDbConnectionString");

            this.productListRepository = new ProductListRepository(alltOchMerDataContext);
            this.productRepository     = new ProductRepository(alltOchMerDataContext);
        }