Ejemplo n.º 1
0
        public bool CreateProduct(ProductVM prod)
        {
            var _prod = new Product();

            _ctx.Products.Add(prod.ToEntity(_prod));
            _ctx.SaveChanges();
            return(true);
        }
Ejemplo n.º 2
0
        public bool UpdateProduct(ProductVM prod)
        {
            var _prod = _ctx.Products.Where(p => p.Id == prod.Id).FirstOrDefault();

            _prod = prod.ToEntity(_prod);
            _ctx.SaveChanges();
            return(true);
        }