You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Dotnet-WebAPI/API/Controllers/TacticController.cs

32 lines
829 B

using System.ComponentModel.DataAnnotations;
using API.Validation;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Services;
namespace API.Controllers;
[ApiController]
public class TacticController(ITacticService service) : ControllerBase
{
[HttpPut("/tactic/{tacticId:int}/name")]
[Authorize]
public async Task<IActionResult> UpdateName(
int tacticId,
[Range(1, 50)] [Name] string name)
{
var userId = this.CurrentUserId();
if (!await service.HasAnyRights(userId, tacticId))
{
return Forbid();
}
return await service.UpdateName(tacticId, name) ? Ok() : NotFound();
}
// [Authorize]
// public async Task<IActionResult> SetTacticStepContent(int tacticId, int stepId)
// {
//
// }
}