Facing a issue Razor redirecttopage 400 error rss

Viewed 25

I am trying to redirect to a page in the controller action in my localhost, but I am getting 400 errors. (Stock.cshtml is under Views-StockSales.) Any ideas on how can I fix this?

public async Task<ActionResult<IList<Coupon>>> Stock(int quantity, string game)
        {
            
            try
            {
                var coupons = new List<Coupon>();
                var games = new StockSales { Product = game, Quantity = quantity };

                var content = await games.CallGameAsync("Test", "12345", game, quantity);
                var json = JObject.Parse(content);
                coupons = JsonConvert.DeserializeObject<List<Coupon>>(json["coupons"]?.ToString() ?? string.Empty);

                return RedirectToPage("/StockSales/Stock", coupons);
            }
            catch (Exception e)
            {

                //NLOG
                NLog(logger2, "Stock Sales " + e.Message);

               
            }
        }

Thanks.

0 Answers
Related