コード例 #1
0
        protected async System.Threading.Tasks.Task Grid0RowSelect(Flashcardgenerator.Models.Localhost.Card args)
        {
            var dialogResult = await DialogService.OpenAsync <EditCard>("Edit Card", new Dictionary <string, object>() { { "cardId", args.cardId } });

            await grid0.Reload();

            await InvokeAsync(() => { StateHasChanged(); });
        }
コード例 #2
0
        public async Task <Models.Localhost.Card> CancelCardChanges(Models.Localhost.Card item)
        {
            var entityToCancel = Context.Entry(item);

            entityToCancel.CurrentValues.SetValues(entityToCancel.OriginalValues);
            entityToCancel.State = EntityState.Unchanged;

            return(item);
        }
コード例 #3
0
        public async Task <Models.Localhost.Card> CreateCard(Models.Localhost.Card card)
        {
            OnCardCreated(card);

            Context.Cards.Add(card);
            Context.SaveChanges();

            OnAfterCardCreated(card);

            return(card);
        }
コード例 #4
0
        protected async System.Threading.Tasks.Task Form0Submit(Flashcardgenerator.Models.Localhost.Card args)
        {
            try
            {
                var localhostCreateCardResult = await Localhost.CreateCard(card);

                DialogService.Close(card);
            }
            catch (System.Exception localhostCreateCardException)
            {
                NotificationService.Notify(new NotificationMessage()
                {
                    Severity = NotificationSeverity.Error, Summary = $"Error", Detail = $"Unable to create new Card!"
                });
            }
        }
コード例 #5
0
        protected async System.Threading.Tasks.Task Form0Submit(Flashcardgenerator.Models.Localhost.Card args)
        {
            try
            {
                var localhostUpdateCardResult = await Localhost.UpdateCard(cardId, card);

                DialogService.Close(card);
            }
            catch (System.Exception localhostUpdateCardException)
            {
                NotificationService.Notify(new NotificationMessage()
                {
                    Severity = NotificationSeverity.Error, Summary = $"Error", Detail = $"Unable to update Card"
                });

                hasChanges = localhostUpdateCardException is DbUpdateConcurrencyException;
            }
        }
コード例 #6
0
        protected async System.Threading.Tasks.Task Load()
        {
            var localhostGetBriefsResult = await Localhost.GetBriefs();

            getBriefsForbriefIdResult = localhostGetBriefsResult;

            var localhostGetCategoriesResult = await Localhost.GetCategories();

            getCategoriesForcategoryIdResult = localhostGetCategoriesResult;

            var localhostGetSentencesResult = await Localhost.GetSentences();

            getSentencesForsentenceIdResult = localhostGetSentencesResult;

            card = new Flashcardgenerator.Models.Localhost.Card()
            {
            };
        }
コード例 #7
0
        public async Task <Models.Localhost.Card> UpdateCard(int?cardId, Models.Localhost.Card card)
        {
            OnCardUpdated(card);

            var itemToUpdate = Context.Cards
                               .Where(i => i.cardId == cardId)
                               .FirstOrDefault();

            if (itemToUpdate == null)
            {
                throw new Exception("Item no longer available");
            }
            var entryToUpdate = Context.Entry(itemToUpdate);

            entryToUpdate.CurrentValues.SetValues(card);
            entryToUpdate.State = EntityState.Modified;
            Context.SaveChanges();

            OnAfterCardUpdated(card);

            return(card);
        }
コード例 #8
0
        protected async System.Threading.Tasks.Task Load()
        {
            var localhostGetBriefsResult = await Localhost.GetBriefs(new Query()
            {
                Filter = $@"briefId eq ""{Globals.selectedBriefId}"""
            });

            getBriefsResult = localhostGetBriefsResult;

            var localhostGetCategoriesResult = await Localhost.GetCategories();

            getCategoriesResult = localhostGetCategoriesResult;

            var localhostGetSentencesResult = await Localhost.GetSentences();

            getSentencesResult = localhostGetSentencesResult;

            card = new Flashcardgenerator.Models.Localhost.Card()
            {
            };

            if (string.IsNullOrEmpty(search))
            {
                search = "";
            }

            var localhostGetCardsResult = await Localhost.GetCards(new Query()
            {
                Filter = $@"briefId eq ""{Globals.selectedBriefId}""", Expand = "Brief,Category,Sentence"
            });

            getCardsResult = localhostGetCardsResult;

            var localhostGetBriefBybriefIdResult = await Localhost.GetBriefBybriefId(Globals.selectedBriefId);

            briefObj = localhostGetBriefBybriefIdResult;
        }
コード例 #9
0
 protected async System.Threading.Tasks.Task Grid0RowDoubleClick(Flashcardgenerator.Models.Localhost.Card args)
 {
     await DialogService.OpenAsync <EditCard>("Edit Card", new Dictionary <string, object>() { { "cardId", args.cardId } });
 }
コード例 #10
0
        protected async System.Threading.Tasks.Task Grid1RowSelect(Flashcardgenerator.Models.Localhost.Card args, dynamic data)
        {
            var dialogResult = await DialogService.OpenAsync <EditCard>("Edit Card", new Dictionary <string, object>() { { "cardId", args.cardId } });

            await grid1.Reload();
        }
コード例 #11
0
 partial void OnAfterCardUpdated(Models.Localhost.Card item);
コード例 #12
0
 partial void OnCardGet(Models.Localhost.Card item);
コード例 #13
0
 partial void OnAfterCardDeleted(Models.Localhost.Card item);
コード例 #14
0
 partial void OnCardCreated(Models.Localhost.Card item);