MapTo/test/TestConsoleApp/Program.cs

70 lines
1.8 KiB
C#
Raw Normal View History

2021-02-07 13:51:49 +03:00
using System;
using TestConsoleApp.Data.Models;
using TestConsoleApp.ViewModels;
using TestConsoleApp.ViewModels2;
2021-01-27 10:53:29 +03:00
namespace TestConsoleApp
{
internal class Program
{
private static void Main(string[] args)
2021-02-13 14:27:32 +03:00
{
//UserTest();
var manager1 = new Manager
{
Id = 1,
EmployeeCode = "M001",
Level = 100
};
var manager2 = new Manager
{
Id = 2,
EmployeeCode = "M002",
Level = 100,
Manager = manager1
};
var employee1 = new Employee
{
Id = 101,
EmployeeCode = "E101",
Manager = manager1
};
var employee2 = new Employee
{
Id = 102,
EmployeeCode = "E102",
Manager = manager2
};
manager1.Employees = new[] { employee1, manager2 };
manager2.Employees = new[] { employee2 };
manager1.ToManagerViewModel();
employee1.ToEmployeeViewModel();
2021-02-13 14:27:32 +03:00
}
private static void UserTest()
2021-01-27 10:53:29 +03:00
{
2021-02-07 13:51:49 +03:00
var user = new User
{
Id = 1234,
RegisteredAt = DateTimeOffset.Now,
Profile = new Profile
{
FirstName = "John",
LastName = "Doe"
}
};
var vm = user.ToUserViewModel();
Console.WriteLine("Key: {0}", vm.Key);
Console.WriteLine("RegisteredAt: {0}", vm.RegisteredAt);
Console.WriteLine("FirstName: {0}", vm.Profile.FirstName);
Console.WriteLine("LastName: {0}", vm.Profile.LastName);
2021-01-27 10:53:29 +03:00
}
}
}