示例#1
0
 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
         });
     }
 }
示例#2
0
 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
         });
     }
 }
示例#3
0
 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
         });
     }
 }
示例#4
0
 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
         });
     }
 }
示例#5
0
 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
         });
     }
 }
示例#6
0
 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
         });
     }
 }
示例#7
0
 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
         });
     }
 }
示例#8
0
        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
                });
            }
        }