private async void SubmitCommandExcute(object obj) { try { if (!IsBusy) { IsBusy = true; var dialog = new ThanksPopupPage(); dialog.BindingContext = this; if (!string.IsNullOrEmpty(AddFeedback.Name) && !string.IsNullOrEmpty(AddFeedback.Email) && !string.IsNullOrEmpty(AddFeedback.Feedback)) { var feedBackService = new FeedBackService(); var result = await feedBackService.AddFeedback(AddFeedback); if (result.Status == "Success") { FeedbackAdded = "Thank you for your feedback"; await PopupNavigation.Instance.PushAsync(dialog); Device.StartTimer(new TimeSpan(0, 0, 5), () => { App.Current.MainPage.Navigation.PushAsync(new HomePage()); return(false); }); } else { FeedbackAdded = "Something wrong happen try agian later"; await App.Current.MainPage.Navigation.PushAsync(new HomePage()); } } else { FeedbackAdded = "Please fill out all the fields"; await PopupNavigation.Instance.PushAsync(dialog); } } } catch (Exception e) { IsBusy = false; Crashes.TrackError(e); } finally { IsBusy = false; } }
public Status addFeedBack(FeedBack feedback) { var status = Status.Success; try { var existFeedback = feedBackService.GetFeedbackByID(feedback.FeedbackId); if (existFeedback != null) { status = Status.ExistError; } else { feedBackService.AddFeedback(feedback); } } catch (Exception) { status = Status.DBError; } return(status); }