2021-02-07 13:51:49 +03:00
|
|
|
|
using System;
|
|
|
|
|
using MapTo;
|
|
|
|
|
using TestConsoleApp.Data.Models;
|
2020-12-21 18:53:44 +03:00
|
|
|
|
|
|
|
|
|
namespace TestConsoleApp.ViewModels
|
|
|
|
|
{
|
2021-02-07 13:51:49 +03:00
|
|
|
|
[MapFrom(typeof(User))]
|
2020-12-22 11:28:14 +03:00
|
|
|
|
public partial class UserViewModel
|
|
|
|
|
{
|
2021-02-07 13:51:49 +03:00
|
|
|
|
[MapProperty(SourcePropertyName = nameof(User.Id))]
|
|
|
|
|
[MapTypeConverter(typeof(IdConverter))]
|
|
|
|
|
public string Key { get; }
|
2020-12-22 11:28:14 +03:00
|
|
|
|
|
2021-02-07 13:51:49 +03:00
|
|
|
|
public DateTimeOffset RegisteredAt { get; set; }
|
2021-01-07 11:17:36 +03:00
|
|
|
|
|
2021-02-07 13:51:49 +03:00
|
|
|
|
// [IgnoreProperty]
|
|
|
|
|
public ProfileViewModel Profile { get; set; }
|
2021-01-07 11:17:36 +03:00
|
|
|
|
|
2021-02-07 13:51:49 +03:00
|
|
|
|
private class IdConverter : ITypeConverter<int, string>
|
2021-01-07 11:17:36 +03:00
|
|
|
|
{
|
2021-07-29 19:40:55 +03:00
|
|
|
|
public string Convert(int source, object[]? converterParameters) => $"{source:X}";
|
2021-01-07 11:17:36 +03:00
|
|
|
|
}
|
2020-12-22 11:28:14 +03:00
|
|
|
|
}
|
2020-12-21 18:53:44 +03:00
|
|
|
|
}
|