public GetBookmarkedEventsResponseDTO GetAllBookmarkedEvents() { try { List <EventRecord> allEvents = _bookmarkRepo.GetAllBookmarkedEvents(); return(new GetBookmarkedEventsResponseDTO() { EventRecords = allEvents.Select(x => EventRecordTransformer.Transform(x)).ToList() }); } catch (RepoException e) { return(new GetBookmarkedEventsResponseDTO() { Status = e.Message }); } }
public GetEventsByRadiusResponseDTO GetEventsByRadius([FromBody] GetEventsByRadiusRequestDTO region) { try { List <EventRecord> events = _eventRepo.GetEventsByRadius(region.X, region.Y, region.Radius); return(new GetEventsByRadiusResponseDTO() { EventRecords = events.Select(x => EventRecordTransformer.Transform(x)).ToList() }); } catch (RepoException e) { return(new GetEventsByRadiusResponseDTO() { Status = e.Message }); } }
public GetEventsByTimeRangeResponseDTO PostGetEventsByTimeRange([FromBody] GetEventsByTimeRangeRequestDTO timeInterval) { try { List <EventRecord> eventsInTimeInterval = _eventRepo.GetEventsByTimeRange(timeInterval.StartTime, timeInterval.EndTime); return(new GetEventsByTimeRangeResponseDTO { Events = eventsInTimeInterval.Select(x => EventRecordTransformer.Transform(x)).ToList() }); } catch (RepoException e) { return(new GetEventsByTimeRangeResponseDTO() { Status = e.Message }); } }
public GetEventsByUserIdResponseDTO GetEventsByUserId([FromUri] GetEventsByUserIdRequestDTO currentUserId) { try { List <EventRecord> userEvents = _eventRepo.GetEventsByUserId(currentUserId.UserId); return(new GetEventsByUserIdResponseDTO() { Events = userEvents.Select(x => EventRecordTransformer.Transform(x)).ToList() }); } catch (RepoException e) { return(new GetEventsByUserIdResponseDTO() { Status = e.Message }); } }
public UpdateEventResponseDTO PutUpdateEvent([FromBody] UpdateEventRequestDTO updateEventRequest) { try { string updateEventResponse = _eventRepo.UpdateEvent(EventRecordTransformer.Transform(updateEventRequest.UpdatedEvent)); return(new UpdateEventResponseDTO { Status = updateEventResponse }); } catch (RepoException e) { return(new UpdateEventResponseDTO() { Status = e.Message }); } }
public AddNewBookmarkResponseDTO PostAddNewBookmark([FromBody] AddNewBookmarkRequestDTO addBookmarkRequest) { try { EventRecord eventRecord = EventRecordTransformer.Transform(addBookmarkRequest.EventRecord); string addNewBookmarkResponse = _bookmarkRepo.AddNewBookmark(eventRecord); return(new AddNewBookmarkResponseDTO() { Status = addNewBookmarkResponse }); } catch (RepoException e) { return(new AddNewBookmarkResponseDTO() { Status = e.Message }); } }
public PostNewEventResponseDTO PostNewEvent([FromBody] PostNewEventRequestDTO newEvent) { //context.Request.Headers["Authorization"]; try { string newEventResponse = _eventRepo.PostNewEvent(EventRecordTransformer.Transform(newEvent.NewEvent)); return(new PostNewEventResponseDTO { Status = newEventResponse }); } catch (RepoException e) { return(new PostNewEventResponseDTO() { Status = e.Message }); } }
public GetEventByIdResponseDTO GetEventById([FromUri] GetEventByIdRequestDTO eventIdRequest) { int eventId = eventIdRequest.EventId; try { EventRecord retrievedEvent = _eventRepo.GetEventById(eventId); EventRecordDTO retrievedEventDTO = EventRecordTransformer.Transform(retrievedEvent); return(new GetEventByIdResponseDTO() { EventRecord = retrievedEventDTO }); } catch (RepoException e) { return(new GetEventByIdResponseDTO() { Status = e.Message }); } }