Skip to content
Snippets Groups Projects

Feature/fix evaluations

Merged Enzo Santangelo Dodera requested to merge feature/fix-evaluations into develop
12 files
+ 1175
39
Compare changes
  • Side-by-side
  • Inline
Files
12
@@ -16,10 +16,13 @@ namespace Tsi1.Api.Controllers
public class EvaluationController : ControllerBase
{
private readonly IEvaluationService _evaluationService;
private readonly IEvaluationTypeService _evaluationTypeService;
public EvaluationController(IEvaluationService evaluationService)
public EvaluationController(IEvaluationService evaluationService, IEvaluationTypeService evaluationTypeService)
{
_evaluationService = evaluationService;
_evaluationTypeService = evaluationTypeService;
}
[Authorize(Roles = UserTypes.Student)]
@@ -134,5 +137,33 @@ namespace Tsi1.Api.Controllers
return Ok(result.Data);
}
[Authorize(Roles = UserTypes.Student + ", " + UserTypes.FacultyAdmin + ", " + UserTypes.Professor)]
[HttpGet("GetEvaluationTypes")]
public async Task<IActionResult> GetEvaluationTypes()
{
var result = await _evaluationTypeService.GetAll();
if (result.HasError)
{
return BadRequest(result.Message);
}
return Ok(result.Data);
}
[Authorize(Roles = UserTypes.Student + ", " + UserTypes.FacultyAdmin + ", " + UserTypes.Professor)]
[HttpGet("GetEvaluationTypeById/{evaluationTypeId}")]
public async Task<IActionResult> GetEvaluationTypeById(int evaluationTypeId)
{
var result = await _evaluationTypeService.GetById(evaluationTypeId);
if (result.HasError)
{
return BadRequest(result.Message);
}
return Ok(result.Data);
}
}
}
Loading