Ejemplo n.º 1
0
        public async Task <ActionResult <Guid> > Post([FromBody] SeasonDto season)
        {
            if (!await _authService.CanUserEdit(User, season.ClubId))
            {
                return(Unauthorized());
            }
            var seasonBizObj = _mapper.Map <Season>(season);
            await _clubService.SaveNewSeason(seasonBizObj);

            var savedSeason =
                (await _clubService.GetFullClubExceptScores(season.ClubId))
                .Seasons
                .First(c => c.Name == season.Name);

            return(Ok(savedSeason.Id));
        }