Ejemplo n.º 1
0
        public async Task <IActionResult> CreateTutorial([FromBody] CreateOrUpdateTutorialRequest request)
        {
            Guid.TryParse(User.FindFirst("id")?.Value, out var userId);

            var createdTutorial = await _tutorialService.CreateTutorialAsync(userId, request);

            if (createdTutorial != null)
            {
                return(Created(ApiHelper.GetResourceUri(HttpContext.Request, ApiRoutes.Tutorial.Get, createdTutorial.Id), _mapper.Map <TutorialShortResponse>(createdTutorial)));
            }
            return(BadRequest());
        }