public ActionResult Edit(Pacient pacient) { if (ModelState.IsValid) { db.Entry(pacient).State = EntityState.Modified; var response = DBHelper.SaveChanges(db); if (response.Succeeded) { return(RedirectToAction("Index")); } ModelState. AddModelError( string.Empty, response.Message); } ViewBag.AfpeID = new SelectList( ComboBoxStateHelper.GetAfpes(), "AfpeID", "Description", pacient.AfpeID); ViewBag.ArprID = new SelectList( ComboBoxStateHelper.GetArps(), "ArprID", "Description", pacient.ArprID); ViewBag.CityID = new SelectList( ComboBoxStateHelper. GetCities(pacient.StateID), "CityID", "Name", pacient.CityID); ViewBag.CivilID = new SelectList( ComboBoxStateHelper.GetCivils(), "CivilID", "Description", pacient.CivilID); ViewBag.DocumentTypeID = new SelectList( ComboBoxStateHelper.GetDocumentTypes(), "DocumentTypeID", "Description", pacient.DocumentTypeID); ViewBag.DriveLicenseID = new SelectList( ComboBoxStateHelper.GetLicenses(), "DriveLicenseID", "Description", pacient.DriveLicenseID); ViewBag.EpsaID = new SelectList( ComboBoxStateHelper.GetEpsas(), "EpsaID", "Description", pacient.EpsaID); ViewBag.FactorRhID = new SelectList( ComboBoxStateHelper.GetFactors(), "FactorRhID", "Description", pacient.FactorRhID); ViewBag.GenderID = new SelectList( ComboBoxStateHelper.GetGenders(), "GenderID", "Description", pacient.GenderID); ViewBag.MilitaryServiceID = new SelectList( ComboBoxStateHelper.GetMilitaries(), "MilitaryServiceID", "Options", pacient.MilitaryServiceID); ViewBag.ProfessionID = new SelectList( ComboBoxStateHelper.GetProfessions(), "ProfessionID", "Description", pacient.ProfessionID); ViewBag.SchoolLevelID = new SelectList( ComboBoxStateHelper.GetLevels(), "SchoolLevelID", "Description", pacient.SchoolLevelID); ViewBag.StateID = new SelectList( ComboBoxStateHelper.GetStates(), "StateID", "Name", pacient.StateID); return(View(pacient)); }
// GET: Pacients/Create public ActionResult Create() { ViewBag.AfpeID = new SelectList( ComboBoxStateHelper.GetAfpes(), "AfpeID", "Description"); ViewBag.ArprID = new SelectList( ComboBoxStateHelper.GetArps(), "ArprID", "Description"); ViewBag.CityID = new SelectList( ComboBoxStateHelper.GetCities(0), "CityID", "Name"); ViewBag.CivilID = new SelectList( ComboBoxStateHelper.GetCivils(), "CivilID", "Description"); ViewBag.DocumentTypeID = new SelectList( ComboBoxStateHelper.GetDocumentTypes(), "DocumentTypeID", "Description"); ViewBag.DriveLicenseID = new SelectList( ComboBoxStateHelper.GetLicenses(), "DriveLicenseID", "Description"); ViewBag.EpsaID = new SelectList( ComboBoxStateHelper.GetEpsas(), "EpsaID", "Description"); ViewBag.FactorRhID = new SelectList( ComboBoxStateHelper.GetFactors(), "FactorRhID", "Description"); ViewBag.GenderID = new SelectList( ComboBoxStateHelper.GetGenders(), "GenderID", "Description"); ViewBag.MilitaryServiceID = new SelectList( ComboBoxStateHelper.GetMilitaries(), "MilitaryServiceID", "Options"); ViewBag.ProfessionID = new SelectList( ComboBoxStateHelper.GetProfessions(), "ProfessionID", "Description"); ViewBag.SchoolLevelID = new SelectList( ComboBoxStateHelper.GetLevels(), "SchoolLevelID", "Description"); ViewBag.StateID = new SelectList( ComboBoxStateHelper.GetStates(), "StateID", "Name"); return(View()); }
// GET: Pacients/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult( HttpStatusCode.BadRequest)); } var pacient = db.Pacients.Find(id); if (pacient == null) { return(HttpNotFound()); } ViewBag.AfpeID = new SelectList( ComboBoxStateHelper.GetAfpes(), "AfpeID", "Description", pacient.AfpeID); ViewBag.ArprID = new SelectList( ComboBoxStateHelper.GetArps(), "ArprID", "Description", pacient.ArprID); ViewBag.CityID = new SelectList( ComboBoxStateHelper. GetCities(pacient.StateID), "CityID", "Name", pacient.CityID); ViewBag.CivilID = new SelectList( ComboBoxStateHelper.GetCivils(), "CivilID", "Description", pacient.CivilID); ViewBag.DocumentTypeID = new SelectList( ComboBoxStateHelper.GetDocumentTypes(), "DocumentTypeID", "Description", pacient.DocumentTypeID); ViewBag.DriveLicenseID = new SelectList( ComboBoxStateHelper.GetLicenses(), "DriveLicenseID", "Description", pacient.DriveLicenseID); ViewBag.EpsaID = new SelectList( ComboBoxStateHelper.GetEpsas(), "EpsaID", "Description", pacient.EpsaID); ViewBag.FactorRhID = new SelectList( ComboBoxStateHelper.GetFactors(), "FactorRhID", "Description", pacient.FactorRhID); ViewBag.GenderID = new SelectList( ComboBoxStateHelper.GetGenders(), "GenderID", "Description", pacient.GenderID); ViewBag.MilitaryServiceID = new SelectList( ComboBoxStateHelper.GetMilitaries(), "MilitaryServiceID", "Options", pacient.MilitaryServiceID); ViewBag.ProfessionID = new SelectList( ComboBoxStateHelper.GetProfessions(), "ProfessionID", "Description", pacient.ProfessionID); ViewBag.SchoolLevelID = new SelectList( ComboBoxStateHelper.GetLevels(), "SchoolLevelID", "Description", pacient.SchoolLevelID); ViewBag.StateID = new SelectList( ComboBoxStateHelper.GetStates(), "StateID", "Name", pacient.StateID); return(View(pacient)); }