Files
app/APP/Utility/StringAssemble.cs
2022-04-18 16:08:19 +02:00

60 lines
1.1 KiB
C#

using System.Text;
using APP.DTO;
namespace APP.Utility;
public static class StringAssemble
{
public static string UserInfo(User? user)
{
if (user == null)
{
return string.Empty;
}
var sb = new StringBuilder();
sb.Append("MAL ID:");
sb.AppendLine();
sb.Append("Last online:");
sb.AppendLine();
if (!string.IsNullOrEmpty(user.Location))
{
sb.Append("Location:");
sb.AppendLine();
}
sb.Append("Joined:");
sb.AppendLine();
return sb.ToString();
}
public static string UserData(User? user)
{
if (user == null)
{
return string.Empty;
}
var sb = new StringBuilder();
sb.Append(user.Id);
sb.AppendLine();
sb.Append(user.LastOnline);
sb.AppendLine();
if (!string.IsNullOrEmpty(user.Location))
{
sb.Append(user.Location);
sb.AppendLine();
}
sb.Append(user.Joined.ToShortDateString());
sb.AppendLine();
return sb.ToString();
}
}