コード例 #1
0
        public async Task <IActionResult> CreateNewProfile([FromQuery] string userId, [FromBody] UserProfile profile)
        {
            if (userId == null)
            {
                return(BadRequest($"Parameter is not defined in body {nameof(userId)}"));
            }
            if (profile == null)
            {
                return(BadRequest($"Parameter is not defined in body {nameof(profile)}"));
            }

            var wasSuccessful = await _profileService.AddUserProfile(Guid.Parse(userId), profile);

            if (wasSuccessful)
            {
                return(Ok(profile));
            }
            return(BadRequest());
        }