public Model.Product AddNewProduct(Model.Product product) { Entity.Product prodToAdd = _context.Products.Add(_mapper.ParseProduct(product, true)).Entity; _context.SaveChanges(); return(_mapper.ParseProduct(prodToAdd)); }
public void UpdateProduct(Product product2BUpated) { Entity.Product oldProduct = _context.Products.Find(product2BUpated.Id); _context.Entry(oldProduct).CurrentValues.SetValues(_mapper.ParseProduct(product2BUpated)); _context.SaveChanges(); _context.ChangeTracker.Clear(); }
public void UpdateInventory(Product inv) { Entity.Product oldInv = _context.Products.Find(inv.ProductName); _context.Entry(oldInv).CurrentValues.SetValues(_mapper.ParseProduct(inv)); _context.SaveChanges(); _context.ChangeTracker.Clear(); }
public Model.Product ParseProduct(Entity.Product product) { return(new Model.Product { ProductName = product.Name, ProductPrice = product.Price, ProductID = product.Id, }); }
public Model.Product GetProduct(Model.Product product) { Entity.Product found = _context.Products.FirstOrDefault(prod => prod.ItemName == product.ItemName && prod.Price == product.Price && prod.Description == product.Description); if (found == null) { return(null); } Log.Information("DL sent product to BL"); return(new Model.Product(found.ProductId, found.ItemName, found.Price, found.Description)); }
public Model.Product ParseProduct(Entity.Product product) { return(new Model.Product() { Id = product.Location, ProductName = (Model.Pie)product.ProductName, Price = product.Price, PieCount = product.PieCount, }); }
//get product from db and map to model public Model.Product ParseProduct(Entity.Product product) { return(new Model.Product { ProductName = product.ProductName, ProductDescription = product.ProductDescription, Price = product.ProductPrice, Id = (int)product.Id }); }
public Model.Product ParseProduct(Entity.Product product) { return(new Model.Product { ProductName = product.ProductName, ProductDescription = product.ProductDescription, ProductID = product.ProductID, ProductPrice = (double)product.ProductPrice }); }
public Model.Product ParseProduct(Entity.Product product) { return(new Model.Product { ProdName = product.ProdName, ProdPrice = product.ProdPrice, ProdCategory = (Model.Category)product.ProdCategory, ProdBrandName = product.ProdBrandName, Id = product.Id }); }
public Model.Product ParseProduct(Entity.Product product) { if (product is null) { return(null); } return(new Model.Product { Id = product.Id, Name = product.PName, Description = product.PDesc, Price = product.Price, Category = product.Category }); }
public Model.Product GetProductByName(string name) { Entity.Product found = _context.Products.FirstOrDefault(loc => loc.PName == name); return(_mapper.ParseProduct(found)); }
public Model.Product GetProductById(int id) { Entity.Product found = _context.Products.FirstOrDefault(loc => loc.Id == id); return(_mapper.ParseProduct(found)); }
public Model.Product GetProduct(string barcode) { Entity.Product found = _context.Products.FirstOrDefault(p => p.Barcode == barcode); return((found == null) ? null : new Model.Product(found.Id, found.Name, found.Price, found.Barcode)); }
public Product GetProductById(int id) { Entity.Product found = _context.Products.FirstOrDefault(p => p.Id == id); return((found == null) ? null : new Model.Product(found.Id, found.Name, found.Price, found.Barcode)); }
public Model.Product ParseProduct(Entity.Product product) { Model.Product newProduct = new Model.Product(product.ProductName, decimal.ToDouble(product.Price), product.Description); newProduct.ProductID = product.ProductId; return(newProduct); }