示例#1
0
        public async Task <ClubDTO> PatchAsync(ClubUpdateDTO club)
        {
            this.Logger.LogTrace($"{nameof(this.PutAsync)} called");

            var result = await this.ClubUpdateService.UpdateAsync(this.Mapper.Map <ClubUpdateModel>(club));

            return(this.Mapper.Map <ClubDTO>(result));
        }
示例#2
0
        public async Task <ClubUpdateDTO> UpdateClub(ClubUpdateDTO club)
        {
            var mappedClub = _mapper.Map <Club>(club);

            await RemoveClubActivities(mappedClub);
            await RemoveClubTrainers(mappedClub);
            await RemoveClubPictures(mappedClub);
            await RemoveClubWorkingHours(mappedClub);
            await RemoveClubPrices(mappedClub);

            var returnedClub = await _clubRepository.UpdateClub(mappedClub);

            return(_mapper.Map <ClubUpdateDTO>(returnedClub));
        }
示例#3
0
        public async Task <ActionResult <ClubUpdateDTO> > UpdateClub([FromBody] ClubUpdateDTO club)
        {
            try
            {
                var returnedClub = await _clubService.UpdateClub(club);

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