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()); }
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)); }
public bool Delete(Stock.Dto.Model.Product.ProductDTO entity) { Product delete = rep.GetOne(entity.ProductId); return(rep.Delete(delete)); }