Exemplo n.º 1
0
        public async Task UpdateAsync(EditedClubDetails editDetails)
        {
            var club = await GetAsync(editDetails.ID);

            if (club == null)
            {
                throw new ResourceNotFoundException($"No club found with ID {editDetails.ID}");
            }

            _mapper.Map(editDetails, club);
            await _context.SaveChangesAsync();
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Update(EditedClubDetails newDetails)
        {
            if (newDetails == null)
            {
                return(BadRequest());
            }

            try
            {
                await _golfClubsRepository.UpdateAsync(newDetails);

                return(Ok());
            }
            catch (ResourceNotFoundException)
            {
                return(NotFound());
            }
        }