C
C#3mo 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
No description
No description
6 Replies
Angius
Angius3mo ago
How to solve... what?
blueberriesiftheywerecats
Show program.cs
Mon AFK
Mon AFK3mo ago
I'm sorry for missing this
blueberriesiftheywerecats
Try adding app.UseSwagger(); app.UseSwaggerUI();
Mon AFK
Mon AFK3mo ago
I have added it but it cant changed anything:<<
Want results from more Discord servers?
Add your server