Добавил поддержку загрузки изображений
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 1m23s
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 1m23s
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using PaydayBackend.Models;
|
||||
using PaydayBackend.Services;
|
||||
|
||||
@@ -21,10 +22,13 @@ public class AdminController : ControllerBase
|
||||
/// Добавление банка
|
||||
/// </summary>
|
||||
[HttpPost("banks")]
|
||||
public async Task<ActionResult> AddBank([FromBody] Bank bank)
|
||||
public async Task<ActionResult> AddBank([MaxLength(50)][MinLength(3)] string bankName, IFormFile file)
|
||||
{
|
||||
await _adminService.AddBank(bank);
|
||||
return Ok();
|
||||
string result = await _adminService.AddBank(bankName, file);
|
||||
if (result == "ОК")
|
||||
return Ok(result);
|
||||
|
||||
return BadRequest(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -78,12 +82,17 @@ public class AdminController : ControllerBase
|
||||
/// Добавление университета
|
||||
/// </summary>
|
||||
[HttpPost("universities")]
|
||||
public async Task<ActionResult> AddUniversity([FromBody] University university)
|
||||
public async Task<ActionResult> AddUniversity([MaxLength(15)][MinLength(2)] string shortName, [MaxLength(60)][MinLength(5)] string fullName, IFormFile file)
|
||||
{
|
||||
await _adminService.AddUniversity(university);
|
||||
return Ok();
|
||||
string result = await _adminService.AddUniversity(shortName, fullName, file);
|
||||
if (result == "ОК")
|
||||
return Ok(result);
|
||||
|
||||
return BadRequest(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// TODO: Переделать
|
||||
/// <summary>
|
||||
/// Добавление направления университета
|
||||
|
14
PaydayBackend/Controllers/BankController.cs
Normal file
14
PaydayBackend/Controllers/BankController.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace PaydayBackend.Controllers;
|
||||
|
||||
[Route("v1/api/bank")]
|
||||
[ApiController]
|
||||
public class BankController : ControllerBase
|
||||
{
|
||||
|
||||
public BankController()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
16
PaydayBackend/Controllers/UniversityController.cs
Normal file
16
PaydayBackend/Controllers/UniversityController.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace PaydayBackend.Controllers;
|
||||
|
||||
[Route("v1/api/university")]
|
||||
[ApiController]
|
||||
public class UniversityController : ControllerBase
|
||||
{
|
||||
|
||||
public UniversityController()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user