Exemplo n.º 1
0
        public async Task <IActionResult> Create([FromBody] CreateSocialMediaDto model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            await _socialMediaService.CreateSocialMedia(model);

            return(Ok());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Post([FromBody] CreateSocialMediaDto model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            IdentityResult result = await _socialMediaService.CreateSocialMedia(model);

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