Esempio n. 1
0
 public ActionResult Edit([Bind(Include = "ID,IDTelaio,IDParte,IDDanno,IDGravita,InsertDate,NoteDanno")] RPC_DanniXTelaio rPC_DanniXTelaio)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rPC_DanniXTelaio).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IDDanno   = new SelectList(db.RPC_Danni, "ID", "Descr", rPC_DanniXTelaio.IDDanno);
     ViewBag.IDGravita = new SelectList(db.RPC_Gravita, "ID", "Descr", rPC_DanniXTelaio.IDGravita);
     ViewBag.IDParte   = new SelectList(db.RPC_Parti, "ID", "Descr", rPC_DanniXTelaio.IDParte);
     ViewBag.IDTelaio  = new SelectList(db.RPC_Telai, "ID", "IDOperatore", rPC_DanniXTelaio.IDTelaio);
     return(View(rPC_DanniXTelaio));
 }
        public ActionResult Edit([Bind(Include = " ID, IDCantiere, IDOperatore, IDLotto, IsFinished, InsertDate, Telaio, " +
                                                 " LastUpdateTime,Condizione, Note")] RPC_Telai rPC_Telai, string SearchResult)
        {
            if (ModelState.IsValid)
            {
                string myIDOperatore = TempData["myIDOperatore"] as string;
                if (rPC_Telai.IsFinished == true)
                {
                    rPC_Telai.IDOperatore = myIDOperatore.ToUpper();
                }
                else
                {
                    rPC_Telai.IDOperatore = null;
                }

                rPC_Telai.LastUpdateTime = DateTime.Now;

                db.Entry(rPC_Telai).State = EntityState.Modified;
                db.SaveChanges();

                var model = new Models.HomeModel();


                string mySearch = TempData["mySearch"] as string;
                string myLotto  = TempData["myLotto"] as string;

                var telai = from s in db.RPC_Telai
                            where s.IDCantiere.ToString() == mySearch && s.IDLotto.ToString() == myLotto
                            select s;

                model.RPC_Telai = telai.ToList();

                TempData["mySearch"] = mySearch;
                TempData["myLotto"]  = myLotto;


                //return View("VinList", model);
                //return View(rPC_Telai);
                return(RedirectToAction("DoRefresh", "Home"));
            }
            else
            {
                return(View(rPC_Telai));
            }
        }