Home > Back-end >  im trying to call a razor
im trying to call a razor

Time:11-23

i try but the call never worked can you helpme with a post related or a solution please i'm stacked with this to go on, i'm working with vs 2022

i try this but the call never worked

enter image description here

CodePudding user response:

i do as you said bu till now did not get to

namespace RTPR.Pages.Admin.Routers
{
    public class RouterModel : PageModel
    {
        private readonly RTDBContext rTDBContext;
        [BindProperty]
        public AddRouter AddRouterRequest { get; set; }



        public RouterModel(RTDBContext rTDBContext)
        {
            this.rTDBContext = rTDBContext;
        }
        public IEnumerable<Puesto> displaydata { get; set; }
        public IEnumerable<Empleado> displaydata1 { get; set; }
        public async Task OnGet()
        {
            displaydata = await rTDBContext.Puestos.ToListAsync();
            displaydata1 = await rTDBContext.Empleados.ToListAsync();
        }


        [HttpPost("/Admin/Routers/Router/GetItems")]
        public ActionResult GetItems(string name)
        {
            return new JsonResult(new List<SelectListItem> { new SelectListItem { Value = "1", Text = name   1 }, new SelectListItem { Value = "2", Text = name   2 } });

        }
    }
}

  • Related