예제 #1
0
        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);
        }
예제 #2
0
        public ActionResult Create(ProduitModels p)
        {
            try
            {
                Products toCreate = ConvertProduct.ConvertProductModel2ProductNotFull(p);
                bll.AjouterProduit(toCreate);

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                return(RedirectToAction("Index"));
            }
        }
예제 #3
0
        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);
        }
예제 #4
0
 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"));
     }
 }
예제 #5
0
        // GET: Product/Details/5
        public ActionResult Details(int id)
        {
            ProduitModels product = new ProduitModels(bll.GetProduct(id));

            return(View("Details", product));
        }