示例#1
0
        public ActionResult Edit(ValidityVM v)
        {
            if (ModelState.IsValid)
            {
                Validity c = new Validity();
                c.ValidityID = v.ValidityID;
                c.Validity1  = v.Validity;

                db.Entry(c).State = EntityState.Modified;
                db.SaveChanges();
                TempData["SuccessMsg"] = "You have successfully Upadated Validity.";
                return(RedirectToAction("Index"));
            }
            return(View());
        }
示例#2
0
        //
        // GET: /Department/Edit/5

        public ActionResult Edit(int id)
        {
            ValidityVM c    = new ValidityVM();
            var        data = (from d in db.Validities where d.ValidityID == id select d).FirstOrDefault();

            if (data == null)
            {
                return(HttpNotFound());
            }
            else
            {
                c.ValidityID = data.ValidityID;
                c.Validity   = data.Validity1;
            }



            return(View(c));
        }
示例#3
0
        public ActionResult Create(ValidityVM v)
        {
            if (ModelState.IsValid)
            {
                Validity d   = new Validity();
                int      vid = db.Validities.OrderByDescending(x => x.ValidityID).Select(x => x.ValidityID).FirstOrDefault();
                vid = vid + 1;

                d.Validity1  = v.Validity;
                d.ValidityID = vid;


                db.Validities.Add(d);
                db.SaveChanges();
                TempData["SuccessMsg"] = "You have successfully added Validity.";
                return(RedirectToAction("Index"));
            }

            return(View());
        }