コード例 #1
0
        public UserDtoOutput Create(UserDtoInput user)
        {
            try
            {
                using var contextTran = db.Database.BeginTransaction();
                User usermodel = new User()
                {
                    UserName     = "******",
                    FirstName    = user.FirstName,
                    LastName     = user.LastName,
                    PasswordHash = user.Password,
                    Email        = user.Email
                };

                User result = UserRepository.Create(usermodel);

                UserDtoOutput output = new UserDtoOutput()
                {
                    UserName  = result.UserName,
                    FirstName = result.FirstName,
                    LastName  = result.LastName,
                    Email     = result.Email,
                    Password  = result.PasswordHash
                };

                return(output);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        public ActionResult <UserDtoOutput> FindByUserName(string UserName)
        {
            UserModel     user    = _userService.FindUserByUsername(UserName);
            UserDtoOutput userDto = _mapper.Map <UserModel, UserDtoOutput>(user);

            return(Ok(userDto));
        }
コード例 #3
0
ファイル: AuthOutput.cs プロジェクト: Nukutka/MyMessenger
 public AuthOutput(UserDtoOutput user, string token)
 {
     User  = user;
     Token = token;
 }