C#C
C#2y ago
Mon AFK

Please help me with this Route

using Northwind.Models;
using Northwind.Interfaces;
using Microsoft.AspNetCore.Mvc;
using Northwind.Dto;
using AutoMapper;
using Northwind.Repository;
using Microsoft.EntityFrameworkCore;


namespace Northwind.Controllers
{
public class EmployeeController
{

[ApiController]
[Route("api/[controller]")]

public class EmployeeControllers : ControllerBase
{
NorthwindContext db = new NorthwindContext();
private readonly IEmployeeRepository _employeeRepository; // Use interface for dependency injection
private readonly NorthwindContext context;

public EmployeeControllers(IEmployeeRepository employeeRepository, NorthwindContext context) // Inject repository in constructor
{
_employeeRepository = employeeRepository;
this.context = context;
}

[HttpGet]
[ProducesResponseType(200)]
public IActionResult GetEmployees()
{
var employees = _employeeRepository.GetEmployees();

if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(employees);
}
}
}
}

I dont know how to solve it, if you have any idea, i'm really apriciate
image.png
image.png
Was this page helpful?