예제 #1
0
        public Language Add(Language language)
        {
            using (var db = new DvdRentalDbContext())
            {
                db.Languages.Add(language);
                db.SaveChanges();
            }

            return(language);
        }
예제 #2
0
        public Language Update(Language language)
        {
            using (var db = new DvdRentalDbContext())
            {
                var updateLanguage = db.Languages.FirstOrDefault(f => f.language_id == language.language_id);

                updateLanguage.name        = language.name;
                updateLanguage.last_update = language.last_update;

                db.SaveChanges();
            }

            return(language);
        }