Fix problem with ulongs on frontend... js does not handle them... at all

This commit is contained in:
Daniel_I_Am 2020-09-29 22:52:14 +02:00
parent 818f71c75a
commit 7c4d007863
No known key found for this signature in database
GPG Key ID: 80C428FCC9743E84
2 changed files with 30 additions and 2 deletions

View File

@ -30,7 +30,9 @@ namespace ChaosBot.WebServer.App
.Where(cc => cc.DiscordGuildId == guildId) .Where(cc => cc.DiscordGuildId == guildId)
.ToList(); .ToList();
return Json(customCommands); List<CustomCommandResponse> response = customCommands.Select(e => new CustomCommandResponse(e)).ToList();
return Json(response);
} }
[HttpPost] [HttpPost]

View File

@ -0,0 +1,26 @@
using System.ComponentModel.DataAnnotations;
using ChaosBot.Models;
namespace ChaosBot.WebServer.Models
{
class CustomCommandResponse
{
[Required]
public string DiscordGuildId { get; }
[Required]
[MaxLength(128)]
public string Command { get; }
[Required]
public CustomCommandType Type { get; }
[Required]
public string Content { get; }
public CustomCommandResponse(CustomCommand command)
{
DiscordGuildId = command.DiscordGuildId.ToString();
Command = command.Command;
Type = command.Type;
Content = command.Content;
}
}
}