Browse Source

fix routes

master
Serg A. Verevkin 10 months ago
parent
commit
3e23c97732
  1. 60
      Controllers/Field2Controller.cs
  2. 9
      Controllers/FieldController.cs
  3. 1
      TextFile.md

60
Controllers/Field2Controller.cs

@ -1,60 +0,0 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace WebApplication1.Controllers
{
[Route("api/v2/[controller]")]
[ApiController]
public class Field2Controller : ControllerBase
{
private IFieldManager _fm;
private ILogger<FieldController> _lg;
/// <summary>
/// .ctor
/// </summary>
/// <param name="fm"></param>
public Field2Controller(
IFieldManager fm,
ILogger<FieldController> lg)
{
_fm = fm;
_lg = lg;
}
[HttpPost(Name = "new")]
[Route("new")]
public Field StartNewGame()
{
return _fm.StartNewGame();
}
[HttpPost(Name = "move")]
[Route("move")]
public Field Move(string identifier)
{
return _fm.Move(identifier);
}
[HttpPost(Name = "move2")]
[Route("move2")]
public Field Move2(string identifier)
{
return _fm.Move(identifier);
}
[HttpGet(Name = "list")]
[Route("list")]
public Field List(string identifier)
{
return _fm.List(identifier);
}
}
}

9
Controllers/FieldController.cs

@ -29,21 +29,18 @@ namespace WebApplication1.Controllers
[HttpPost(Name = "new")] [HttpPost("new")]
[Route("new")]
public Field StartNewGame() public Field StartNewGame()
{ {
return _fm.StartNewGame(); return _fm.StartNewGame();
} }
[HttpPost(Name = "move")] [HttpPost("move")]
[Route("move")]
public Field Move(string identifier) public Field Move(string identifier)
{ {
return _fm.Move(identifier); return _fm.Move(identifier);
} }
[HttpGet(Name = "list")] [HttpGet("list")]
[Route("list")]
public Field List(string identifier) public Field List(string identifier)
{ {
return _fm.List(identifier); return _fm.List(identifier);

1
TextFile.md

@ -8,4 +8,5 @@
- Получить класс через Dependency Injection (конструктор) - Получить класс через Dependency Injection (конструктор)
- Использовать класс для выдачи результата - Использовать класс для выдачи результата
-- https://git.v5a.ru/pi23/practice
-- SET PATH=%PATH%;"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin" -- SET PATH=%PATH%;"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin"
Loading…
Cancel
Save