public static Products ConvertProductModel2ProductNotFull(ProduitModels m) { Products p = new Products(); p.ProductId = m.ProductId; p.ProductCode = m.ProductCode; p.ProductLabel = m.ProductLabel; p.ProductDescription = m.ProductDescription; p.ProductStock = m.ProductStock; p.ProductPrice = m.ProductPrice; p.ProductCategoryId = m.ProductCategorieId; return(p); }
public ActionResult Create(ProduitModels p) { try { Products toCreate = ConvertProduct.ConvertProductModel2ProductNotFull(p); bll.AjouterProduit(toCreate); return(RedirectToAction("Index")); } catch (Exception e) { return(RedirectToAction("Index")); } }
public static Products ConvertProductModel2Product(ProduitModels m, Products pr) { Products p = new Products(); p.ProductId = m.ProductId; p.ProductCode = m.ProductCode; p.ProductLabel = m.ProductLabel; p.ProductDescription = m.ProductDescription; p.ProductActive = pr.ProductActive; p.ProductStock = m.ProductStock; p.ProductPrice = m.ProductPrice; p.ProductStockBuffer = pr.ProductStockBuffer; p.ProductCategoryId = pr.ProductCategoryId; return(p); }
public ActionResult Edit(ProduitModels p) { try { Products product = bll.GetProduct(p.ProductId); if (ModelState.IsValid) { Products toUpdate = ConvertProduct.ConvertProductModel2Product(p, product); bll.ModifierProduit(toUpdate); } return(RedirectToAction("Index")); }catch (Exception e) { return(RedirectToAction("Index")); } }
// GET: Product/Details/5 public ActionResult Details(int id) { ProduitModels product = new ProduitModels(bll.GetProduct(id)); return(View("Details", product)); }