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(); }
public async Task <ActionResult> Update(EditedClubDetails newDetails) { if (newDetails == null) { return(BadRequest()); } try { await _golfClubsRepository.UpdateAsync(newDetails); return(Ok()); } catch (ResourceNotFoundException) { return(NotFound()); } }