コード例 #1
0
        public async Task <IActionResult> CreatePhotographAsync([FromForm] CreatePhotographInput input)
        {
            Result <string> result = await _userAccount.CreatePhotographAsync(input);

            if (result.Success)
            {
                return(Ok(result));
            }
            else
            {
                return(BadRequest(result));
            }
        }
コード例 #2
0
ファイル: UserAccount.cs プロジェクト: marko977x/PHOTOnline
        public async Task <Result <string> > CreatePhotographAsync(CreatePhotographInput input)
        {
            PHOTOnlineUser user = new PHOTOnlineUser()
            {
                FirstName = input.FirstName,
                LastName  = input.LastName,
                Email     = input.Email,
                UserName  = input.Username,
                UserType  = UserType.Photograph
            };

            Result <string> result = await
                                     _authService.CreateUserAsync(user, input.Password);

            await _authService.AddUserToRoleByEmail(
                input.Email, UserType.Photograph.ToString());

            return(result);
        }