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; } }
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); } }
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); }
public Task <MobEvent> AddEventAsync(MobEvent mobEvent) { return(mobEventRestService.AddEventAsync(mobEvent)); }
public Task <MobEvent> UpdateEventAsync(MobEvent mobEvent) { return(mobEventRestService.UpdateEventAsync(mobEvent)); }