コード例 #1
0
        public ActionResult AddGroup(opr.Models.Group mod)
        {
            oprEntities dbgrp = new oprEntities();

            dbgrp.Groups.Add(mod);
            dbgrp.SaveChanges();


            return(View());
        }
コード例 #2
0
        public ActionResult EditGroup(opr.Models.Group grp)
        {
            oprEntities groupData = new oprEntities();

            groupData.Entry(grp).State = System.Data.Entity.EntityState.Modified;
            try
            {
                groupData.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
            }
            ModelState.AddModelError("", "Unable to save changes made to the entity.");
            return(View(grp));
        }