survey-webapp/SurveyBackend/SurveyBackend.API/Mappers/UserMapper.cs
2025-05-31 01:34:42 +05:00

31 lines
No EOL
869 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using SurveyBackend.Core.Models;
using SurveyBackend.DTOs.User;
namespace SurveyBackend.Mappers;
/// <summary>
/// Маппер всего связанного с авторизацией
/// </summary>
public static class UserMapper
{
/// <summary>
/// Перегнать схему регистрации в нового юзера
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
public static User UserRegistrationToModel(UserRegistrationDto dto) => new User
{
Email = dto.Email,
FirstName = dto.FirstName,
LastName = dto.LastName,
Password = dto.Password,
};
public static UserOutputDto ModelToOutput(User model) => new UserOutputDto
{
Id = model.Id,
FirstName = model.FirstName,
LastName = model.LastName,
Email = model.Email,
};
}