PIAPS_CW/Contracts/Converters/UserConverter.cs

35 lines
1.0 KiB
C#
Raw Permalink Normal View History

2024-06-04 23:43:15 +04:00
using Contracts.BindingModels;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.Converters
{
2024-06-22 21:15:11 +04:00
public static class UserConverter
{
public static UserViewModel ToView(UserBindingModel model) => new()
{
Id = model.Id,
FirstName = model.FirstName,
SecondName = model.SecondName,
Email = model.Email,
Birthday = model.Birthday,
OnlyImportantMails = model.OnlyImportantMails,
Role = RoleConverter.ToView(model.Role),
};
2024-06-04 23:43:15 +04:00
2024-06-22 21:15:11 +04:00
public static UserBindingModel ToBinding(UserViewModel model) => new()
{
Id = model.Id,
FirstName = model.FirstName,
SecondName = model.SecondName,
Email = model.Email,
Birthday = model.Birthday,
OnlyImportantMails = model.OnlyImportantMails,
Role = RoleConverter.ToBinding(model.Role),
};
}
2024-06-04 23:43:15 +04:00
}