This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I need to make multiple insert to multiple table have relation with each other all id found in all table primary key and identity what i need actually when user click submit Save the following data Name,Email,Salary,DistrictId in table Employee EmployeeId,CourseId in table EmployeeCourse EmployeeId,LanaguageId,LevelId in table EmployeeLangage what i write in create function in empcourse controller my custom model as following public class Customemployee { public string Name { get; set; } public string Salary { get; set; }
} my controller empcourse is public class empcourseController : Controller { mycourseEntities db = new mycourseEntities(); // GET: empcourse public ActionResult Index() { return View(); } public ActionResult Create() { ViewBag.CountryId = new SelectList(db.Countries.ToList(), "Id", "CountryName"); ViewBag.LanaguageId = new SelectList(db.Languages.ToList(), "Id", "LnaguageName"); ViewBag.LevelId = new SelectList(db.Levels.ToList(), "Id", "LevelName"); ViewBag.CourseId = new SelectList(db.Courses.ToList(), "Id", "CourseName"); return View(); } [HttpPost] public ActionResult Create(Customemployee cemp) { return View(); } public JsonResult getcitybyid(int id) { db.Configuration.ProxyCreationEnabled = false; return Json(db.Cities.Where(a => a.CountryId == id), JsonRequestBehavior.AllowGet); } public JsonResult getdistrictbyid(int id) { db.Configuration.ProxyCreationEnabled = false; return Json(db.Destricts.Where(a => a.CityId == id), JsonRequestBehavior.AllowGet); } } } my Create view is
|