示例#1
0
        public ActionResult Create(Groups groups)
        {
            if (ModelState.IsValid)
            {
                db.Groups.Add(new Groups()
                {
                    Members = new List<User>(),
                    GroupsName = groups.GroupsName,
                    Owner = db.Users.Find(WebSecurity.CurrentUserId)
                });
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(groups);
        }
示例#2
0
 public ActionResult Edit(Groups groups)
 {
     if (ModelState.IsValid)
     {
         db.Entry(groups).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(groups);
 }