Пример #1
0
        public ActionResult Create([Bind(Include = "IDTelaio,IDParte,IDDanno,IDGravita,InsertDate,NoteDanno")] RPC_DanniXTelaio rPC_DanniXTelaio)
        {
            if (ModelState.IsValid)
            {
                db.RPC_DanniXTelaio.Add(rPC_DanniXTelaio);
                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));
        }
Пример #2
0
        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));
            }
        }