async Task SearchEvents() { if (Search.StartDate != null && Search.EndDate != null && Search.StartDate > Search.EndDate) { AppStore.AddNotification(new NotificationMessage("Le date non sono corrette", NotificationMessage.MessageType.Warning)); } else { ReportLists = await Http.GetReportConfirmedIntervalledAsync(Search.StartDate.ToLocalTime(), Search.EndDate.ToLocalTime().EndOfDay()); } }
async Task Export() { var response = await Http.GenerateReportEvents(Search.StartDate, Search.EndDate); if (response.IsSuccessStatusCode) { AppStore.AddNotification(new NotificationMessage("Il report verrà inviato via mail agli amministratori", NotificationMessage.MessageType.Info)); } else { AppStore.AddNotification(new NotificationMessage("Errore generazione del report", new Exception(response.ReasonPhrase))); } }
async Task Success() { var result = await Http.CreateEvent(EventViewModel).ConfigureAwait(false); if (result.IsSuccessStatusCode) { string resultId = await result.Content.ReadAsStringAsync().ConfigureAwait(false); if (AppStore.EventImage != null) { await Http.UploadEventImage(EventViewModel.Id, AppStore.EventImage).ConfigureAwait(false); } AppStore.AddNotification(new NotificationMessage("Evento sottomesso", NotificationMessage.MessageType.Success)); } else { string error = await result.Content.ReadAsStringAsync(); AppStore.AddNotification(new NotificationMessage("Errore nella creazione", NotificationMessage.MessageType.Danger)); } }
async Task Success() { var result = await Http.CreateCommunity(CommunityViewModel).ConfigureAwait(false); if (result.IsSuccessStatusCode) { string resultId = await result.Content.ReadAsStringAsync().ConfigureAwait(false); if (AppStore.EventImage != null) { string shortname = CommunityViewModel.Name.Replace(" ", "-").ToLowerInvariant(); await Http.UploadCommunityImage(shortname, AppStore.CommunityImage).ConfigureAwait(false); } AppStore.AddNotification(new NotificationMessage("Community sottomessa", NotificationMessage.MessageType.Success)); } else { string error = await result.Content.ReadAsStringAsync(); AppStore.AddNotification(new NotificationMessage("Errore nella creazione", NotificationMessage.MessageType.Danger)); } }
async Task Success() { var e = new EventViewModel { Id = EventViewModel.Id, StartDate = EventViewModel.StartDate, EndDate = EventViewModel.EndDate, CFP = string.IsNullOrEmpty(EventViewModel.CFP.Url) ? null : EventViewModel.CFP, CommunityName = EventViewModel.Community.ShortName, Name = EventViewModel.Name }; if (!string.IsNullOrEmpty(EventViewModel.BuyTicket)) { e.BuyTicket = EventViewModel.BuyTicket; } var responseUpdate = await Http.UpdateEvent(e).ConfigureAwait(false); if (responseUpdate.IsSuccessStatusCode) { if (AppStore.EventImage != null) { var responseUploadMessage = await Http.UploadEventImage(e.Id, AppStore.EventImage).ConfigureAwait(false); if (!responseUploadMessage.IsSuccessStatusCode) { AppStore.AddNotification(new NotificationMessage("Errore salvataggio", NotificationMessage.MessageType.Danger)); } else { AppStore.AddNotification(new NotificationMessage("Evento salvato", NotificationMessage.MessageType.Success)); } } else { AppStore.AddNotification(new NotificationMessage("Evento salvato", NotificationMessage.MessageType.Success)); } } }