public ActionResult Index(ChildrenDetail objChildrenDetail)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    ChildrenDetailsEntities db = new ChildrenDetailsEntities();

                    if (TempData["ID"] != null)
                    {
                        int            ID = Convert.ToInt32(TempData["ID"]);
                        ChildrenDetail objChildrenDetails = db.ChildrenDetails.FirstOrDefault(x => x.ID == ID);
                        if (objChildrenDetails != null)
                        {
                            objChildrenDetail.ID = ID;
                            db.ChildrenDetails.AddOrUpdate(objChildrenDetail);
                            db.SaveChanges();
                        }
                    }
                    else
                    {
                        db.ChildrenDetails.Add(objChildrenDetail);
                        db.SaveChanges();
                    }
                    ModelState.Clear();
                    return(RedirectToAction("Index"));
                }

                return(View(objChildrenDetail));
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// Delete existing records of childredn from ChildrenList page and from database as well
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>

        public ActionResult Delete(int id)
        {
            try
            {
                ChildrenDetailsEntities db = new ChildrenDetailsEntities();
                ChildrenDetail          objChildrenDetail = db.ChildrenDetails.Find(id);
                db.ChildrenDetails.Remove(objChildrenDetail);
                db.SaveChanges();
                return(RedirectToAction("ChildrenLists"));
            }
            catch (Exception)
            {
                throw;
            }
        }
 /// <summary>
 /// Select existing records of children from ChildrenList page to Update in database
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult Edit(int id)
 {
     try
     {
         using (ChildrenDetailsEntities db = new ChildrenDetailsEntities())
         {
             ChildrenDetail model = new ChildrenDetail();
             model.SelectedCustomer = db.ChildrenDetails.Find(id);
             model.DisplayMode      = "ReadOnly";
             TempData["ID"]         = id;
             return(View("Index", model.SelectedCustomer));
         }
     }
     catch (Exception)
     {
         throw;
     }
 }