public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } var productId = Guid.Parse(httpContextAccessor.HttpContext.Request.Query["id"].ToString()); try { Input.ProductId = productId; buildService.CreateBuild(Input); } catch (DbUpdateException ex) { ModelState.AddModelError(string.Empty, "Unable to save changes. Please try again." + ex.Message); } return(RedirectToPage("/Dashboard/Product/Details", new { id = productId })); }