public IActionResult AddDocPage(string returnUrl, int GroupID) { var model = new AddDocPageViewModel { returnUrl = returnUrl, GroupID = GroupID, GroupName = Repository.Groups.FirstOrDefault(x => x.GroupID == GroupID)?.GroupName ?? "Public" }; return(View(model)); }
public IActionResult AddDocPage(AddDocPageViewModel model) { if (ModelState.IsValid) { Documentation.AddPage(new DocPage { GroupID = model.GroupID, Name = model.Name, Date = model.Date }); return(LocalRedirect(model.returnUrl)); } return(View(model)); }