public async Task <IActionResult> OnGet( [FromServices] GetProduct getProduct, string name) { Product = await getProduct.Action(name.Replace("-", " ")); if (Product == null) { return(RedirectToPage("/Index")); } else { return(Page()); } }
public IActionResult GetProduct( int id, [FromServices] GetProduct getProduct) => Ok(getProduct.Action(id));