Exemplo n.º 1
0
 public static Entities.User Map(ApplicationCore.Models.User user)
 {
     return(new Entities.User
     {
         UserId = user.Id,
         Username = user.Username,
         Email = user.Email,
         Role = user.Role,
         CreatedDate = user.CreatedDate
     });
 }
Exemplo n.º 2
0
        public async Task <ApplicationCore.Models.User> AddUserAsync(ApplicationCore.Models.User user)
        {
            if (user is null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            Entities.User entity = Mapper.Map(user);

            await _context.User.AddAsync(entity);

            await _context.SaveChangesAsync();

            return(Mapper.Map(entity));
        }