public ActionResult Create([Bind(Include = "MilitaryServiceID,Options")] MilitaryService militaryService) { if (ModelState.IsValid) { db.MilitaryServices.Add(militaryService); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(militaryService)); }
public ActionResult Create([Bind(Include = "L250ID,Values")] L250 l250) { if (ModelState.IsValid) { db.L250.Add(l250); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(l250)); }
public ActionResult DeleteConfirmed(int id) { var state = db.States.Find(id); db.States.Remove(state); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { var documentType = db.DocumentTypes.Find(id); db.DocumentTypes.Remove(documentType); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { var epsa = db.Epsas.Find(id); db.Epsas.Remove(epsa); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { var schoolLevel = db.SchoolLevels.Find(id); db.SchoolLevels.Remove(schoolLevel); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { Arpr arpr = db.Arprs.Find(id); db.Arprs.Remove(arpr); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { Civil civil = db.Civils.Find(id); db.Civils.Remove(civil); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { var gender = db.Genders.Find(id); db.Genders.Remove(gender); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { FactorRh factorRh = db.FactorRhs.Find(id); db.FactorRhs.Remove(factorRh); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { var driveLicense = db.DriveLicenses.Find(id); db.DriveLicenses.Remove(driveLicense); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { Profession profession = db.Professions.Find(id); db.Professions.Remove(profession); db.SaveChanges(); return(RedirectToAction("Index")); }
public static Response SaveChanges(SisoCdataContext db) { try { db.SaveChanges(); return(new Response { Succeeded = true, }); } catch (Exception ex) { var response = new Response { Succeeded = false, }; if (ex.InnerException != null && ex.InnerException.InnerException != null && ex.InnerException.InnerException.Message.Contains("_Index")) { response.Message = "Ya Existe un Registro con el Mismo Valor"; } else if (ex.InnerException != null && ex.InnerException.InnerException != null && ex.InnerException.InnerException.Message.Contains("REFERENCE")) { response.Message = "El Registro Seleccionado no Se Puede Eliminar, Porque Ya Posee Registros Relacionados"; } else { response.Message = ex.Message; } return(response); } }
public ActionResult Create(Users users) { if (ModelState.IsValid) { if (users.PhotoUsersFile != null) { //var pic = string.Empty; var folder = "~/Content/Users"; var file = string.Format("{0}.jpg", users.UsersID); var response2 = FileImageUpLoad. UploadPhoto( users.PhotoUsersFile, folder, file); if (response2) { var pic = string. Format("{0}/{1}", folder, file); users.PhotoUsers = pic; db.Entry(users).State = EntityState.Modified; db.SaveChanges(); } } if (users.FirmUsersFile != null) { //var pic2 = string.Empty; var folder2 = "~/Content/FirmUsers"; var file = string.Format("{0}.jpg", users.UsersID); var response2 = FileImageUpLoad. UploadPhoto( users.FirmUsersFile, folder2, file); if (response2) { var pic2 = string. Format("{0}/{1}", folder2, file); users.FirmUsers = pic2; db.Entry(users).State = EntityState.Modified; db.SaveChanges(); } } db.Users.Add(users); var response = DBHelper.SaveChanges(db); if (response.Succeeded) { return(RedirectToAction("Index")); } ModelState. AddModelError( string.Empty, response.Message); } ViewBag.CityID = new SelectList( ComboBoxStateHelper. GetCities(users.StateID), "CityID", "Name", users.CityID); ViewBag.DocumentTypeID = new SelectList( ComboBoxStateHelper. GetDocumentTypes(), "DocumentTypeID", "Description", users.DocumentTypeID); ViewBag.StateID = new SelectList( ComboBoxStateHelper.GetStates(), "StateID", "Name", users.StateID); return(View(users)); }
public ActionResult Create(TypeLogin typelogin) { if (ModelState.IsValid) { db.TypeLogins.Add(typelogin); var response = DBHelper.SaveChanges(db); if (response.Succeeded) { return(RedirectToAction("Index")); } ModelState. AddModelError( string.Empty, response.Message); if (typelogin.FirmLoginFile != null) { var folder3 = "~/Content/FirmAcces"; var file4 = string.Format("{0}.jpg", typelogin.TypeLoginID); var response4 = FileImageUpLoad. UploadPhoto( typelogin.FirmLoginFile, folder3, file4); if (response4) { var pic4 = string. Format("{0}/{1}", folder3, file4); typelogin.FirmLogin = pic4; db.Entry(typelogin).State = EntityState.Modified; db.SaveChanges(); } } } ViewBag.UniversityID = new SelectList( ComboBoxStateHelper. GetUniversities(), "UniversityID", "Description", typelogin.UniversityID); ViewBag.UserRolesID = new SelectList( ComboBoxStateHelper. GetRoles(), "UserRolesID", "Description", typelogin.UserRolesID); ViewBag.UsersID = new SelectList( ComboBoxStateHelper. GetUsers(), "UsersID", "UserName", typelogin.UsersID); return(View(typelogin)); }