public ActionResult AddUsers(Group group) { try { var usergroup = new UsersGroup { UserID = group.UserID, GroupID = group.GroupID }; db.UsersGroups.Add(usergroup); db.SaveChanges(); return RedirectToAction("AddUsers", new { id = group.GroupID }); } catch(Exception ex) { Group dto = db.Groups.Find(group.GroupID); this.ModelState.AddModelError(string.Empty, ex.Message); return View(dto); } }
// GET: Groups/Create public ActionResult CreateGroup(string formView) { var dto = new Group { FormView = formView }; return PartialView("_Create", dto); }