예제 #1
0
        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));
        }
예제 #2
0
        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"));
        }
예제 #3
0
        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"));
        }