Beispiel #1
0
        public async Task <UserDto> CreateAsync(NewUser newUser)
        {
            var _user = _mapper.NewToEntity(newUser);

            _context.Add(_user);
            await _context.SaveChangesAsync();

            return(_mapper.EntityToDto(_user));
        }
Beispiel #2
0
 public static UserDto Read(int id)
 {
     using (var db = new MainDBModelContainer())
     {
         var data = db.UserSet.Find(id);
         if (data != null)
         {
             return(UserMapper.EntityToDto(data));
         }
         throw new ElementNotFoundException();
     }
 }