Beispiel #1
0
        public async Task <IActionResult> UpdateProfile([FromBody] ProfileCreatedDto profileDto, [FromRoute] int profileId)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var itemModel = dtoMapper.Map <ProfileCreatedDto, ProfileNamespace.Profile>(profileDto);

            await profileService.UpdateProfileAsync(itemModel, profileId);

            return(Ok("User Profile updated"));
        }
Beispiel #2
0
        public async Task <IActionResult> CreateProfile([FromBody] ProfileCreatedDto profileDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var itemModel = dtoMapper.Map <ProfileCreatedDto, ProfileNamespace.Profile>(profileDto);
            await profileService.CreateProfileAsync(itemModel);

            return(Created(
                       this.BaseApiUrl + "/" + itemModel.Id,
                       new { UserId = itemModel.Id }
                       ));
        }