예제 #1
0
        public async Task <IActionResult> Post([FromForm] RegisterModel registerModel)
        {
            var userExists = _userService.IfUserExists(registerModel.UserName);

            if (userExists)
            {
                return(Unauthorized("Username has already been taken"));
            }

            var profilePic = await _fileService.SaveProfilePic(registerModel.ProfilePicture);

            var user = _userService.Register(registerModel);

            user.ProfilePic = profilePic;

            return(Ok(user));
        }