Todo : Fix format

RestService : Fix connection if first connection fail
BL : Fix Update/Delete return value
This commit is contained in:
2019-03-28 00:23:44 +01:00
parent 8b0820ece4
commit b8d49cea69
5 changed files with 70 additions and 19 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.Text;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
@@ -38,12 +39,21 @@ namespace LaDOSE.DiscordBot.Command
break;
case "LIST":
var todoDtos = dep.WebService.RestService.GetTodos();
foreach (var task in todoDtos)
{
string taskStatus = task.Done ? ":white_check_mark:" : ":negative_squared_cross_mark:";
await ctx.RespondAsync($"{task?.Id} - {task?.Task} Par : {task?.User} Etat : {taskStatus}");
StringBuilder sb = new StringBuilder();
sb.AppendLine("Todos: ");
if (todoDtos!=null && todoDtos.Count>0)
{
foreach (var task in todoDtos)
{
string taskStatus = task.Done ? ":white_check_mark:" : ":negative_squared_cross_mark:";
sb.AppendLine($"{task.Id} | {taskStatus} | {task.User} | {task.Task}");
}
}
else
{
sb.AppendLine("None.");
}
await ctx.RespondAsync(sb.ToString());
break;
case "DEL":
try