Ejemplo n.º 1
0
        public async Task <ClubCreateDTO> CreateClub(ClubCreateDTO club)
        {
            var mappedClub   = _mapper.Map <Club>(club);
            var returnedClub = await _clubRepository.CreateClub(mappedClub);

            return(_mapper.Map <ClubCreateDTO>(returnedClub));
        }
Ejemplo n.º 2
0
        public async Task <ClubDTO> PutAsync(ClubCreateDTO club)
        {
            this.Logger.LogTrace($"{nameof(this.PutAsync)} called");

            var result = await this.ClubCreateService.CreateAsync(this.Mapper.Map <ClubUpdateModel>(club));

            return(this.Mapper.Map <ClubDTO>(result));
        }
Ejemplo n.º 3
0
        public async Task <ActionResult <ClubCreateDTO> > CreateClub([FromBody] ClubCreateDTO club)
        {
            try
            {
                var returnedClub = await _clubService.CreateClub(club);

                return(Ok(returnedClub));
            }
            catch (Exception exception)
            {
                return(BadRequest(exception.Message));
            }
        }