public IActionResult OnPost(MajorType major) { if (ModelState.IsValid) { Input.MajorId = major; var newId = _bonusService.Save(Input); if (Input.Id != newId) { return(CustomRedirect(SitePages.MajorEditorBonusesEdit, new { id = newId })); } } Prepare(Input.Id); return(Page()); }