Example #1
0
        public async Task <IActionResult> Create([FromBody] CoachViewModel model)
        {
            var user = await GetCurrentUserAsync();

            if (user.Coach != null)
            {
                return(BadRequest("You have coach account already."));
            }

            var coach = model.Adapt <Coach>();

            user.Coach = coach;
            await _coachService.CreateAsync(coach);

            return(Ok(coach.Id));
        }