product business
This commit is contained in:
1 parent
39e9737476
commit
219b0483f6
1 file changed
+21
@@ -38,7 +38,28 @@ namespace LuminousSales.Business
|
||||
|
||||
public void Update(Product product)
|
||||
{
|
||||
using (productContext = new ProductContext())
|
||||
{
|
||||
var item = productContext.Products.Find(product.Id);
|
||||
if (item != null)
|
||||
{
|
||||
productContext.Entry(item).CurrentValues.SetValues(product);
|
||||
productContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
using (productContext = new ProductContext())
|
||||
{
|
||||
var product = productContext.Products.Find(id);
|
||||
if (product != null)
|
||||
{
|
||||
productContext.Products.Remove(product);
|
||||
productContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user