public ActionResult DeleteConfirmed(int id)
        {
            DieryRecord student = database.DieryRecords.Find(id);

            database.DieryRecords.Remove(student);
            database.SaveChanges();
            return(RedirectToAction("GetNumberList"));
        }
        public ActionResult Edit(int id)
        {
            DieryRecord record = new DieryRecord();

            var Studentdata = database.DieryRecords.Where(x => x.Person_ID == id).SingleOrDefault();

            ViewBag.R_FK_CATID = new SelectList(database.DieryRecords, "Person_ID", "R_FK_CATID", record.Person_ID);
            return(View(Studentdata));
        }
        // GET: /Student/Delete/5
        public ActionResult Delete(int id)
        {
            DieryRecord student = database.DieryRecords.Where(x => x.Person_ID == id).SingleOrDefault();

            if (student == null)
            {
                return(HttpNotFound());
            }
            return(View(student));
        }
        public ActionResult RegisterContact(DieryRecord record)
        {
            int sid = Convert.ToInt32(Session["AD_ID"]);
            List <TBL_CATEGORY> cat = database.TBL_CATEGORY.Where(x => x.CAT_PK_ADID == sid).ToList();

            ViewBag.list = new SelectList(cat, "CAT_ID", "CAT_NAME");

            DieryRecord reco = new DieryRecord();

            reco.Person_FirstName    = record.Person_FirstName;
            reco.Person_LastName     = record.Person_LastName;
            reco.Person_MobileNumber = record.Person_MobileNumber;
            reco.Person_HomeNumber   = record.Person_HomeNumber;
            reco.Person_City         = record.Person_City;
            reco.Person_Tehsil       = record.Person_Tehsil;
            reco.Person_District     = record.Person_District;
            reco.Person_State        = record.Person_State;
            reco.R_FK_CATID          = record.R_FK_CATID;
            database.DieryRecords.Add(reco);
            database.SaveChanges();
            TempData["msg"] = "Question added Successfully.....!";
            TempData.Keep();
            return(RedirectToAction("RegisterContact"));
        }
 public ActionResult Edit(DieryRecord record)
 {
     database.Entry(record).State = EntityState.Modified;
     database.SaveChanges();
     return(RedirectToAction("GetNumberList"));
 }