示例#1
0
 public ActionResult StockEdit(Stock stock)
 {
     var stk = CutModel.Stocks;
     var old = stk.Where(x => x.Id == stock.Id).FirstOrDefault();
     if (old != null)
     {
         var idx = stk.IndexOf(old);
         stk.RemoveAt(idx);
         stk.Insert(idx, stock);
         TempData["message"] = "Stock Modifié";
         ClearResult(CutModel);
     }
     else
     {
         TempData["erreur"] = "Impossible de modifer le stock id:" + stock.Id;
     }
     return View("Index", CutModel);
 }
示例#2
0
        public ActionResult ToCutCreate(Stock stock)
        {
            if (ModelState.IsValid)
            {
                TempData["message"] = "Débit creer";
                ClearResult(CutModel);
                CutModel.ToCut.Add(stock);

            }
            else
                TempData["erreur"] = string.Format("erreur lors de la creation de {0}", stock.ToString());
            //return View("Index", cutModel);
            return RedirectToAction("index", CutModel);
        }