public ActionResult SaveOrder(string name, AcHolder[] acHolders)
        {
            using (var db = new ApplicationDbContext())
            {
                string result = "Error! AcHolder Is Not Complete!";
                if (name != null && acHolders != null)
                {
                    //var GradeId = Guid.NewGuid();
                    AcTitle model = new AcTitle();

                    model.AccountType = name;
                    db.acTitle.Add(model);

                    foreach (var item in acHolders)
                    {
                        //var PlayerId = Guid.NewGuid();
                        AcHolder O = new AcHolder();

                        O.AcHolderName = item.AcHolderName;
                        O.Email        = item.Email;
                        O.Phone        = item.Phone;
                        O.DoB          = item.DoB;
                        O.Amount       = item.Amount;
                        O.AcTitleId    = item.AcTitleId;
                        db.AcHolders.Add(O);
                    }
                    db.SaveChanges();
                    result = "Success! Order Is Complete!";
                }
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
 public ActionResult EditOrder([Bind(Include = "AcHolderId,AcHolderName,Email,Phone,DoB,Amount,AcTitleId")] AcHolder acHolders)
 {
     using (var db = new ApplicationDbContext())
     {
         if (ModelState.IsValid)
         {
             db.Entry(acHolders).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         ViewBag.acHoldersId = new SelectList(db.acTitle, "AcTitleId", "AccountType", acHolders.AcTitleId);
         return(View(acHolders));
     }
 }
 public ActionResult EditOrder(int id)
 {
     using (var db = new ApplicationDbContext())
     {
         if (id == null)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         AcHolder acHolders = db.AcHolders.Find(id);
         if (acHolders == null)
         {
             return(HttpNotFound());
         }
         ViewBag.CustomerId = new SelectList(db.acTitle, "AcTitleId", "AccountType", acHolders.AcTitleId);
         return(View(acHolders));
     }
 }