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

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

            if (next_of_kin == null)
            {
                return(HttpNotFound());
            }
            return(View(next_of_kin));
        }
예제 #3
0
        public JsonResult AddNextofKin(next_of_kin NextofKinObj)
        {
            try
            {
                var db = new qhsedbEntities();
                db.next_of_kin.Add(NextofKinObj);
                db.SaveChanges();



                return(Json("Added New NextofKin Entry Successfully", JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(e.Message, JsonRequestBehavior.AllowGet));
            }
        }
예제 #4
0
        public JsonResult Edit(next_of_kin NextofKinObj)
        {
            try
            {
                var db = new qhsedbEntities();
                if (ModelState.IsValid)
                {
                    NextofKinObj.id = NextofKinObj.id;
                    db.Entry(NextofKinObj).State = EntityState.Modified;

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



                return(Json("Edited NextofKin System", JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(e.Message, JsonRequestBehavior.AllowGet));
            }
        }
예제 #5
0
        public ActionResult Delete(int?id)

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

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



            var NextofKinRow = db.next_of_kin.Find(id);

            db.next_of_kin.Remove(NextofKinRow);

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