예제 #1
0
        public void addNøkkelord_InsertItem()
        {
            var item = new Kampanjer.Models.Keyword();
            TryUpdateModel(item);
            if (ModelState.IsValid)
            {
                using (ApplicationDbContext db = new ApplicationDbContext ())
                {
                    db.Keywords.Add(item);
                    db.SaveChanges();
                    addNøkkelord.Visible = false;
                }

            }
        }
예제 #2
0
        // This is the Insert method to insert the entered Keyword item
        // USAGE: <asp:FormView InsertMethod="InsertItem">
        public void InsertItem()
        {
            using (_db)
            {
                var item = new Kampanjer.Models.Keyword();

                TryUpdateModel(item);

                if (ModelState.IsValid)
                {
                    // Save changes
                    _db.Keywords.Add(item);
                    _db.SaveChanges();

                    Response.Redirect("Default");
                }
            }
        }