Esempio n. 1
0
        public bool Update(Stock.Dto.Model.Product.ProductDTO entity)
        {
            Product update = rep.Context.Set <Product>().FirstOrDefault(x => x.ProductId == entity.ProductId);

            update.ProductId    = entity.ProductId;
            update.ProductName  = entity.ProductName;
            update.UnitPrice    = entity.UnitPrice;
            update.UnitsInStock = entity.UnitsInStock;
            return(rep.Update());
        }
Esempio n. 2
0
        public bool Add(Stock.Dto.Model.Product.ProductDTO entity)
        {
            Product product = new Product
            {
                ProductId    = entity.ProductId,
                ProductName  = entity.ProductName,
                UnitPrice    = entity.UnitPrice,
                UnitsInStock = entity.UnitsInStock
            };

            return(rep.Add(product));
        }
Esempio n. 3
0
        public bool Delete(Stock.Dto.Model.Product.ProductDTO entity)
        {
            Product delete = rep.GetOne(entity.ProductId);

            return(rep.Delete(delete));
        }