示例#1
0
        public ActionResult Create(dbo_protection_programs dbo_protection_programs)
        {
            if (ModelState.IsValid)
            {
                var db = new qhsedbEntities();
                db.dbo_protection_programs.Add(dbo_protection_programs);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(dbo_protection_programs));
        }
示例#2
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var db = new qhsedbEntities();
            dbo_protection_programs dbo_protection_programs = db.dbo_protection_programs.Find(id);

            if (dbo_protection_programs == null)
            {
                return(HttpNotFound());
            }
            return(View(dbo_protection_programs));
        }
示例#3
0
        public JsonResult Edit(dbo_protection_programs dbo_protection_programs)
        {
            try
            {
                var db = new qhsedbEntities();
                if (ModelState.IsValid)
                {
                    dbo_protection_programs.id = dbo_protection_programs.id;
                    db.Entry(dbo_protection_programs).State = EntityState.Modified;

                    // loanRequest.LoanDate = loanRequest.LoanDate;
                    db.SaveChanges();
                }



                return(Json("Edited Protection System", JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(e.Message, JsonRequestBehavior.AllowGet));
            }
        }
示例#4
0
        public ActionResult Delete(int?id)

        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var db = new qhsedbEntities();
            dbo_protection_programs dbo_protection_programs = db.dbo_protection_programs.Find(id);

            if (dbo_protection_programs == null)
            {
                return(HttpNotFound());
            }



            var dbo_protection_programsRow = db.dbo_protection_programs.Find(id);

            db.dbo_protection_programs.Remove(dbo_protection_programsRow);

            db.SaveChanges();
            return(RedirectToAction("Index"));
        }