Пример #1
0
        public ActionResult Create(Group group)
        {
            if (ModelState.IsValid)
            {
                db.Groups.Add(group);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(group);
        }
Пример #2
0
 public ActionResult Edit(Group group)
 {
     if (ModelState.IsValid)
     {
         db.Entry(group).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(group);
 }
Пример #3
0
        //Users
        //Setup the users.
        private void SetUpUsersAndGroups()
        {
            user2 = new User { UserId = 2, UserProfileId = 2 };
            user3 = new User { UserId = 3, UserProfileId = 3 };

            sublist1 = new List<User>();

            sublist1.Add(user2);
            sublist1.Add(user3);

            group1 = new Group { GroupID = 1, Users2 = sublist1, IsPrivate = true }; // Owner
            ownlist0 = new List<Group>();
            ownlist0.Add(group1);

            user0 = new User { UserId = 0, UserProfileId = 0, Groups = ownlist0 };
            user1 = new User { UserId = 1, UserProfileId = 1 };

            sublist0 = new List<User>();

            sublist0.Add(user0);
            sublist0.Add(user1);

            group0 = new Group { GroupID = 0, Users2 = sublist0, IsPrivate = false }; // Private

            sublist2 = new List<User>();

            sublist2.Add(user0);
            sublist2.Add(user3);

            user4 = new User { UserId = 4, UserProfileId = 4 };

            //Set up which group each user is subscribed to.

            group2 = new Group { GroupID = 2, Users2 = sublist2, IsPrivate = false }; // Don't show

            group3 = new Group { GroupID = 3, IsPrivate = true };
        }