Example #1
0
        public ActionResult Create(TeamEdit teamEdit)
        {
            ModelState.Merge(teamEdit.Validate(Db));

            if (ModelState.IsValid)
            {
                int[] memberIds;
                Team team = teamEdit.GetModel(UserId, out memberIds);
                TeamCache.Insert(Db, UserId, team, memberIds);
                return RedirectToAction("Index");
            }

            PopulateMemberIds(teamEdit.MemberIds);

            return View(teamEdit);
        }
Example #2
0
        public ActionResult Edit(TeamEdit teamEdit)
        {
            ModelState.Merge(teamEdit.Validate(Db));

            if (ModelState.IsValid)
            {
                int[] memberIds;
                Team team = teamEdit.GetModel(UserId, out memberIds);
                bool success = TeamCache.Update(Db, memberIds, ref team);
                if (!success)
                {
                    return RedirectToAccessDenied();
                }

                return RedirectToAction("Index");
            }

            PopulateMemberIds(teamEdit.MemberIds);

            return View(teamEdit);
        }