public ActionResult Groups(int id, string groupData, string next) { var version = Entities().VariantVersions.Find(id); if (version == null) { return(HttpNotFound()); } UserService users = GetService <UserService>(); if (!users.IsAllowedToEdit(version.Variant, User.Identity.Name)) { return(new HttpUnauthorizedResult()); } DefinitionService definitions = GetService <DefinitionService>(); definitions.SaveDirectionGroups(version, groupData); if (next == "done") { return(RedirectToAction("Edit", "Variants", new { id = version.VariantID })); } else if (next == "prev") { return(RedirectToAction("Relative", new { id })); } else if (next == "next") { return(RedirectToAction("References", new { id })); } return(RedirectToAction("Groups", new { id })); }