Example #1
0
 public ActionResult Delete(int id)
 {
     using (PeopleDataEntities db = new PeopleDataEntities())
     {
         PersonalInfo personal = db.PersonalInfoes.Where(x => x.PersonID == id).FirstOrDefault <PersonalInfo>();
         db.PersonalInfoes.Remove(personal);
         db.SaveChanges();
         return(Json(new { success = true, message = "Deleted Successfully", JsonRequestBehavior.AllowGet }));
     }
 }
Example #2
0
        public ActionResult StoreOrEdit(PersonalInfo people)
        {
            using (PeopleDataEntities db = new PeopleDataEntities())
            {
                if (people.PersonID == 0)
                {
                    db.PersonalInfoes.Add(people);
                    db.SaveChanges();
                    return(Json(new { success = true, message = "Saved Successfully", JsonRequestBehavior.AllowGet }));
                }

                else
                {
                    db.Entry(people).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    return(Json(new { success = true, message = "Updated Successfully", JsonRequestBehavior.AllowGet }));
                }
            }
        }