Exemplo n.º 1
0
        public async Task <MobEvent> AddEventAsync(MobEvent mobEvent)
        {
            try
            {
                var userContext = await GetUserContext().ConfigureAwait(false);

                var httpRequestMessage = new HttpRequestMessage();
                httpRequestMessage        = GetDefaultHeaders(httpRequestMessage);
                httpRequestMessage.Method = HttpMethod.Post;

                httpRequestMessage.Headers.Add("Authorization", "BEARER " + userContext.AccessToken);
                httpRequestMessage.RequestUri = new Uri(EventsApi);

                httpRequestMessage.Content = JsonContent.Create(mobEvent, typeof(MobEvent), null, SerializerOptions);

                HttpClient          client   = new HttpClient();
                HttpResponseMessage response = await client.SendAsync(httpRequestMessage);

                string responseString = await response.Content.ReadAsStringAsync();

                return(JsonConvert.DeserializeObject <MobEvent>(responseString));
            }
            catch (Exception ex)
            {
                Debug.WriteLine(@"\tERROR {0}", ex.Message);
                throw;
            }
        }
Exemplo n.º 2
0
        void OnInfoWindowClick(object sender, GoogleMap.InfoWindowClickEventArgs e)
        {
            var eventPin = GetEventPin(e.Marker);

            if (eventPin == null)
            {
                throw new Exception("Event pin not found");
            }

            if (!string.IsNullOrWhiteSpace(eventPin.Url))
            {
                var mobEvent = new MobEvent();
                MessagingCenter.Send(mobEvent, "EventDetails", eventPin.EventId);
            }
        }
Exemplo n.º 3
0
        private async Task Selected(MobEvent mobEvent)
        {
            if (mobEvent == null)
            {
                return;
            }

            string route;

            if (App.CurrentUser.Id == mobEvent.CreatedByUserId)
            {
                route = $"{nameof(EditEventPage)}?EventId={mobEvent.Id}";
            }
            else
            {
                route = $"{nameof(EventDetailPage)}?EventId={mobEvent.Id}";
            }

            await Shell.Current.GoToAsync(route);
        }
Exemplo n.º 4
0
 public Task <MobEvent> AddEventAsync(MobEvent mobEvent)
 {
     return(mobEventRestService.AddEventAsync(mobEvent));
 }
Exemplo n.º 5
0
 public Task <MobEvent> UpdateEventAsync(MobEvent mobEvent)
 {
     return(mobEventRestService.UpdateEventAsync(mobEvent));
 }