public ActionResult Edit_Get(string code) { var musicmodel = new Music_Instrument(); TryUpdateModel(musicmodel); using (var r = new MusicEntities()) { musicmodel = r.Music_Instruments.Where(x => x.InstrumentCode == code).FirstOrDefault(); } return(View(musicmodel)); }
public ActionResult Create_Post() { var musicmodel = new Music_Instrument(); TryUpdateModel(musicmodel); using (var r = new MusicEntities()) { r.Music_Instruments.Add(musicmodel); r.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult Edit_Post(string code) { var musicmodel = new Music_Instrument(); TryUpdateModel(musicmodel); using (var r = new MusicEntities()) { var m = r.Music_Instruments.Where(x => x.InstrumentCode == code).FirstOrDefault(); TryUpdateModel(m); r.SaveChanges(); } return(RedirectToAction("Index")); }