protected async System.Threading.Tasks.Task Form0Submit(InnovationWebApp.Models.InnovateDb.Idea args) { try { if (isEdit) { var innovateDbUpdateIdeaResult = await InnovateDb.UpdateIdea(idea.id, idea); NotificationService.Notify(NotificationSeverity.Success, $"Success", $"Idea updated!"); } } catch (System.Exception innovateDbUpdateIdeaException) { NotificationService.Notify(NotificationSeverity.Error, $"Error", $"Unable to update Idea"); } try { if (!this.isEdit) { var innovateDbCreateIdeaResult = await InnovateDb.CreateIdea(args); idea = new InnovationWebApp.Models.InnovateDb.Idea(); NotificationService.Notify(NotificationSeverity.Success, $"Success", $"Idea created!"); } } catch (System.Exception innovateDbCreateIdeaException) { NotificationService.Notify(NotificationSeverity.Error, $"Error", $"Unable to create new Idea!"); } }
protected async System.Threading.Tasks.Task Button1Click(MouseEventArgs args) { try { int selectedId = idea.id; var innovateDbGetVoteResult = await InnovateDb.GetVotes(new Query() { Filter = "i => i.email.Equals(@0) && i.id.Equals(@1)", FilterParameters = new object[] { "*****@*****.**", idea.id } }); if (!innovateDbGetVoteResult.Any()) { Vote vote = new Vote(); vote.email = "*****@*****.**"; vote.id = idea.id; var innovateDbCreateVoteResult = await InnovateDb.CreateVote(vote); idea.votes += 1; await InnovateDb.UpdateIdea(idea.id, idea); NotificationService.Notify(NotificationSeverity.Success, $"Success", $"Your vote has been recorded"); } else { NotificationService.Notify(NotificationSeverity.Error, $"Error", $"You have already voted for this idea!"); } } catch (System.Exception innovateDbCreateIdeaException) { NotificationService.Notify(NotificationSeverity.Error, $"Error", $"Unable to add your vote!"); } }
protected async System.Threading.Tasks.Task IdeaSubmit(InnovationWebApp.Models.InnovateDb.Idea args) { try { var innovateDbCreateIdeaResult = await InnovateDb.CreateIdea(idea); NotificationService.Notify(NotificationSeverity.Success, $"Success", $"Your idea has been recorded"); DialogService.Close(idea); UriHelper.NavigateTo("welcome"); } catch (System.Exception innovateDbCreateIdeaException) { NotificationService.Notify(NotificationSeverity.Error, $"Error", $"Unable to create new Idea!"); } }
protected async System.Threading.Tasks.Task Load() { if (string.IsNullOrEmpty(search)) { search = ""; } var innovateDbGetIdeasResult = await InnovateDb.GetIdeas(new Query() { Filter = "i => i.firstName.Contains(@0) || i.lastName.Contains(@1) || i.email.Contains(@2) || i.business.Contains(@3) || i.office.Contains(@4) || i.ideaDescription.Contains(@5) || i.scope.Contains(@6)", FilterParameters = new object[] { search, search, search, search, search, search, search } }); getIdeasResult = innovateDbGetIdeasResult; idea = innovateDbGetIdeasResult.FirstOrDefault(); isEdit = true; }
protected async System.Threading.Tasks.Task GridDeleteButtonClick(MouseEventArgs args, dynamic data) { try { if (await DialogService.Confirm("Are you sure you want to delete this record?") == true) { var innovateDbDeleteIdeaResult = await InnovateDb.DeleteIdea(data.id); if (innovateDbDeleteIdeaResult != null) { await grid0.Reload(); } } } catch (System.Exception innovateDbDeleteIdeaException) { NotificationService.Notify(NotificationSeverity.Error, $"Error", $"Unable to delete Idea"); } }