All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 18s
56 lines
1.8 KiB
C#
56 lines
1.8 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using PaydayBackend.Models;
|
|
using PaydayBackend.Services;
|
|
|
|
namespace PaydayBackend.Controllers;
|
|
|
|
[Route("v1/public")]
|
|
[ApiController]
|
|
public class PublicController : ControllerBase
|
|
{
|
|
private readonly IPublicService _publicService;
|
|
|
|
public PublicController(IPublicService publicService)
|
|
{
|
|
_publicService = publicService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Получение всех университетов
|
|
/// </summary>
|
|
[HttpGet("university")]
|
|
public async Task<IEnumerable<UniversityDto>> GetAllUniversity()
|
|
{
|
|
return await _publicService.GetAllUniversity();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Получение всех направлений университета
|
|
/// </summary>
|
|
/// <response code="400">Университет не найден</response>
|
|
[HttpGet("university/{id}/direction")]
|
|
public async Task<ActionResult<IEnumerable<UniversityDto>>> GetAllUniversityDirectionByUniversityId(long id)
|
|
{
|
|
var result = await _publicService.GetAllUniversityDirectionByUniversityId(id);
|
|
|
|
if (result == null)
|
|
return BadRequest();
|
|
|
|
return Ok(result);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Получение всех возможных условий кредитования банков по стоймости направления
|
|
/// </summary>
|
|
/// <response code="400">Направление не найдено</response>
|
|
[HttpGet("credit/direction/{id}")]
|
|
public async Task<ActionResult<IEnumerable<University>>> GetAllTermsWithDirection(long id)
|
|
{
|
|
var result = await _publicService.GetAllLoansByDirectionCost(id);
|
|
|
|
if (result == null)
|
|
return BadRequest();
|
|
|
|
return Ok(result);
|
|
}
|
|
} |