コード例 #1
0
        public async Task <IActionResult> Update([FromBody] EditSocialMediaDto model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.Values.Select(x => x.Errors.FirstOrDefault().ErrorMessage)));
            }

            await _socialMediaService.EditSocialMedia(model);

            return(Ok());
        }
コード例 #2
0
        public async Task <IActionResult> Put(string Url, [FromBody] EditSocialMediaDto model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.Values.Select(x => x.Errors.FirstOrDefault().ErrorMessage)));
            }

            IdentityResult result = await _socialMediaService.EditSocialMedia(Url, model);

            if (result.Succeeded)
            {
                return(Ok(result));
            }
            return(BadRequest(result.Errors.Select(x => x.Description)));
        }