Use GeneralCommandType enum in GeneralCommand name

This commit is contained in:
Niels van Velzen
2020-09-21 16:53:00 +02:00
parent 7da03d67a7
commit 3459655bb4
5 changed files with 53 additions and 53 deletions

View File

@@ -217,16 +217,15 @@ namespace Jellyfin.Api.Controllers
[FromRoute, Required] string sessionId,
[FromRoute, Required] string command)
{
var name = command;
if (Enum.TryParse(name, true, out GeneralCommandType commandType))
if (!Enum.TryParse(command, true, out GeneralCommandType commandType))
{
name = commandType.ToString();
return BadRequest();
}
var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request);
var generalCommand = new GeneralCommand
{
Name = name,
Name = commandType,
ControllingUserId = currentSession.UserId
};
@@ -249,11 +248,16 @@ namespace Jellyfin.Api.Controllers
[FromRoute, Required] string sessionId,
[FromRoute, Required] string command)
{
if (!Enum.TryParse(command, true, out GeneralCommandType commandType))
{
return BadRequest();
}
var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request);
var generalCommand = new GeneralCommand
{
Name = command,
Name = commandType,
ControllingUserId = currentSession.UserId
};