Esempio n. 1
0
        public ProductDTO GetProduct(int id)
        {
            var p = db.Products.Find(id);

            if (p == null)
            {
                return(new ProductDTO());
            }
            return(new ProductDTO()
            {
                ProductID = p.ProductID
                , ProductName = p.ProductName
                , QuantityPerUnit = p.QuantityPerUnit
                , UnitPrice = p.UnitPrice
                , ProductPct = p.Picture
                , CategoryName = p.Category.CategoryName
                , CategoryPct = ConvertTo.Base64(p.Category.Picture)
                , UnitsInStock = p.UnitsInStock
                , UnitsOnOrder = p.UnitsOnOrder
            });
        }