Beispiel #1
0
        public async Task <ActionResult <GoogleMapsApiKeyApiResponse> > GoogleMapsApiKey(Guid?venueId)
        {
            if (TryGetMemberId() == null)
            {
                VersionedServiceResult <Venue> venue = venueId != null
                    ? await _venueService.GetVenue(null, null, venueId.Value)
                    : new VersionedServiceResult <Venue>(0, null);

                if (venue.Value == null)
                {
                    throw new OdkNotAuthorizedException();
                }
            }

            return(await HandleVersionedRequest(
                       _settingsService.GetSiteSettings,
                       _mapper.Map <GoogleMapsApiKeyApiResponse>));
        }
Beispiel #2
0
        public async Task <IActionResult> GetVenuesById(long Id)
        {
            try
            {
                var response = await _venueService.GetVenue(Id);

                if (response.ResponseCode != ResponseCode.Ok)
                {
                    return(Ok(WebApiResponses <VenueModel> .ErrorOccured(response.Message)));
                }
                return(Ok(WebApiResponses <VenueModel> .Successful(response.ResponseData)));
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                return(Ok(WebApiResponses <VenueModel> .ErrorOccured(ex.Message)));
            }
        }
Beispiel #3
0
        public IActionResult Add(AddSessionViewModel model)
        {
            var talk    = talkService.GetTalk(model.TalkId);
            var venue   = venueService.GetVenue(model.VenueId);
            var session = new Session
            {
                Talk     = talk,
                Start    = model.StartDate.AddHours(model.StartTime),
                Venue    = venue,
                TalkType = talkService.GetTalkType(model.TalkTypeId),
                Status   = SessionStatus.Open
            };

            sessionService.AddSession(session);

            return(View("Index", new SessionListViewModel {
                SessionList = sessionService.GetSessions().ToList()
            }));
        }
Beispiel #4
0
 public async Task <ActionResult <VenueApiResponse> > Get(Guid id)
 {
     return(await HandleVersionedRequest(
                version => _venueService.GetVenue(version, TryGetMemberId(), id),
                _mapper.Map <VenueApiResponse>));
 }