public async Task AddToEvent(Guid eventId, AddLocationToEventRequest request) { var @event = await _eventRepository.Get(eventId); EnsureEventExists(@event); var newLocation = _mapper.Map <Location>(request.Location); await ValidateLocation(newLocation); _locationRepository.AddLocation(@event, newLocation); await EnsureLocationIsSavedInDataBase(); }
public async Task <IActionResult> Add(Guid eventId, [FromBody] AddLocationToEventRequest request) { await _locationService.AddToEvent(eventId, request); return(Ok()); }