Insert multiple entity object on single view form – ASP MVC 3

Posted: April 6, 2012 in web
        // POST: /ContactSheet/Create

        public ActionResult Create(ContactSheet contactsheet)
            if (ModelState.IsValid)
                NatureProblemOther tmp = new NatureProblemOther();
                tmp.OtherDesc = lib.emas() ;
                tmp.ContactSheet = contactsheet;
                tmp.NatureProblemID = 1;

                return RedirectToAction("Index");  
            ViewBag.AgeID = new SelectList(db.Ages, "AgeID", "Description");
            ViewBag.CodeID = new SelectList(db.Codes, "CodeID", "Description", contactsheet.CodeID);
            ViewBag.RaceID = new SelectList(db.Races, "RaceID", "Description", contactsheet.RaceID);
            ViewBag.StudentID = new SelectList(db.Students, "StudentID", "Description", contactsheet.StudentID);
            ViewBag.Problem = db.NatureProblems.ToList();
            ViewBag.Release = db.Releases.ToList();
            ViewBag.Suicide = db.SuicideLists.ToList();

            return View(contactsheet);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s