public ActionResult DeleteConfirmed(int id) { MuseumType museumType = db.MuseumTypes.Find(id); db.MuseumTypes.Remove(museumType); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "MuseumTypeId,MuseumsType")] MuseumType museumType) { if (ModelState.IsValid) { db.Entry(museumType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(museumType)); }
public ActionResult Create([Bind(Include = "MuseumTypeId,MuseumsType")] MuseumType museumType) { if (ModelState.IsValid) { db.MuseumTypes.Add(museumType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(museumType)); }
public void Delete(MuseumType museumType) { if (museumType == null) { throw new ArgumentNullException(nameof(museumType)); } _museumTypeRepository.Delete(museumType); // log }
// GET: MuseumTypes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MuseumType museumType = db.MuseumTypes.Find(id); if (museumType == null) { return(HttpNotFound()); } return(View(museumType)); }
private static void AddOrUpdateMuseumTypes(MuseumObjectContext context) { #region MuseumType var mt1 = new MuseumType { Id = 1, Name = "Achitecture" }; var mt2 = new MuseumType { Id = 2, Name = "Anthropology" }; var mt3 = new MuseumType { Id = 3, Name = "Aquarium" }; var mt4 = new MuseumType { Id = 4, Name = "Arboretum" }; var mt5 = new MuseumType { Id = 5, Name = "Archaeology" }; var mt6 = new MuseumType { Id = 6, Name = "Architecture" }; var mt7 = new MuseumType { Id = 7, Name = "Archive" }; var mt8 = new MuseumType { Id = 8, Name = "Art" }; var mt9 = new MuseumType { Id = 9, Name = "Artistical" }; var mt10 = new MuseumType { Id = 10, Name = "Automotive" }; var mt11 = new MuseumType { Id = 11, Name = "Aviation" }; var mt12 = new MuseumType { Id = 12, Name = "Biology" }; var mt13 = new MuseumType { Id = 13, Name = "Botanical" }; var mt14 = new MuseumType { Id = 14, Name = "Cemetery" }; var mt15 = new MuseumType { Id = 15, Name = "Children's" }; var mt16 = new MuseumType { Id = 16, Name = "Church" }; var mt17 = new MuseumType { Id = 17, Name = "Communications" }; var mt18 = new MuseumType { Id = 18, Name = "Craft" }; var mt19 = new MuseumType { Id = 19, Name = "Culture" }; var mt20 = new MuseumType { Id = 20, Name = "Design" }; var mt21 = new MuseumType { Id = 21, Name = "Education" }; var mt22 = new MuseumType { Id = 22, Name = "Ethnography" }; var mt23 = new MuseumType { Id = 23, Name = "Family" }; var mt24 = new MuseumType { Id = 24, Name = "Film/Photography" }; var mt25 = new MuseumType { Id = 25, Name = "Food/Drink" }; var mt26 = new MuseumType { Id = 26, Name = "General" }; var mt27 = new MuseumType { Id = 27, Name = "Historic House/Site" }; var mt28 = new MuseumType { Id = 28, Name = "Historical Society" }; var mt29 = new MuseumType { Id = 29, Name = "History" }; var mt30 = new MuseumType { Id = 30, Name = "Library" }; var mt31 = new MuseumType { Id = 31, Name = "Maritime" }; var mt32 = new MuseumType { Id = 32, Name = "Military" }; var mt33 = new MuseumType { Id = 33, Name = "Music" }; var mt34 = new MuseumType { Id = 34, Name = "Natural History" }; var mt35 = new MuseumType { Id = 35, Name = "Nature Center" }; var mt36 = new MuseumType { Id = 36, Name = "Open-air" }; var mt37 = new MuseumType { Id = 37, Name = "Park" }; var mt38 = new MuseumType { Id = 38, Name = "Planetarium" }; var mt39 = new MuseumType { Id = 39, Name = "Religion" }; var mt40 = new MuseumType { Id = 40, Name = "Science" }; var mt41 = new MuseumType { Id = 41, Name = "Space" }; var mt42 = new MuseumType { Id = 42, Name = "Specialized" }; var mt43 = new MuseumType { Id = 43, Name = "Technology" }; var mt44 = new MuseumType { Id = 44, Name = "Transport" }; var mt45 = new MuseumType { Id = 45, Name = "University" }; var mt46 = new MuseumType { Id = 46, Name = "War" }; context.Set <MuseumType>().AddOrUpdate( mt1, mt2, mt3, mt4, mt5, mt6, mt7, mt8, mt9, mt10, mt11, mt12, mt13, mt14, mt15, mt16, mt17, mt18, mt19, mt20, mt21, mt22, mt23, mt24, mt25, mt26, mt27, mt28, mt29, mt30, mt31, mt32, mt33, mt34, mt35, mt36, mt37, mt38, mt39, mt40, mt41, mt42, mt43, mt44, mt45, mt46); context.SaveChanges(); #endregion }