mirror of
https://github.com/rjNemo/ticket_manager
synced 2026-06-11 19:26:40 +00:00
uow proj part1
This commit is contained in:
parent
269fc631b5
commit
beeee5b3ba
1 changed files with 3 additions and 8 deletions
|
|
@ -17,12 +17,7 @@ namespace TicketManager.Controllers
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class ProjectsController : ControllerBase
|
public class ProjectsController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly IProjectRepository _projectRepo;
|
private UnitOfWork _context;
|
||||||
|
|
||||||
public ProjectsController(IProjectRepository projectRepo)
|
|
||||||
{
|
|
||||||
_projectRepo = projectRepo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns all existing projects.
|
/// Returns all existing projects.
|
||||||
|
|
@ -38,7 +33,7 @@ namespace TicketManager.Controllers
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
public async Task<IEnumerable<Project>> GetProjects()
|
public async Task<IEnumerable<Project>> GetProjects()
|
||||||
{
|
{
|
||||||
return await _projectRepo.List();
|
return await _context.Projects.List();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -57,7 +52,7 @@ namespace TicketManager.Controllers
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
public async Task<ActionResult<Project>> GetProject(int id)
|
public async Task<ActionResult<Project>> GetProject(int id)
|
||||||
{
|
{
|
||||||
Project project = await _projectRepo.Get(id);
|
Project project = await _context.Projects.Get(id);
|
||||||
if (project == null) { return NotFound(); }
|
if (project == null) { return NotFound(); }
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue