protected async System.Threading.Tasks.Task Grid0RowSelect(Flashcardgenerator.Models.Localhost.Brief args)
        {
            var dialogResult = await DialogService.OpenAsync <EditBrief>("Edit Brief", new Dictionary <string, object>() { { "briefId", args.briefId } });

            await grid0.Reload();

            await InvokeAsync(() => { StateHasChanged(); });
        }
        public async Task <Models.Localhost.Brief> CancelBriefChanges(Models.Localhost.Brief item)
        {
            var entityToCancel = Context.Entry(item);

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

            return(item);
        }
Ejemplo n.º 3
0
        protected async System.Threading.Tasks.Task Load()
        {
            var localhostGetClientsResult = await Localhost.GetClients();

            getClientsForclientIdResult = localhostGetClientsResult;

            brief = new Flashcardgenerator.Models.Localhost.Brief()
            {
            };
        }
        public async Task <Models.Localhost.Brief> CreateBrief(Models.Localhost.Brief brief)
        {
            OnBriefCreated(brief);

            Context.Briefs.Add(brief);
            Context.SaveChanges();

            OnAfterBriefCreated(brief);

            return(brief);
        }
        protected async System.Threading.Tasks.Task Grid0RowExpand(Flashcardgenerator.Models.Localhost.Brief args)
        {
            master = args;

            var localhostGetCardsResult = await Localhost.GetCards(new Query()
            {
                Filter = $@"i => i.briefId == {args.briefId}"
            });

            if (localhostGetCardsResult != null)
            {
                args.Cards = localhostGetCardsResult.ToList();
            }
        }
Ejemplo n.º 6
0
        protected async System.Threading.Tasks.Task Form0Submit(Flashcardgenerator.Models.Localhost.Brief args)
        {
            try
            {
                var localhostCreateBriefResult = await Localhost.CreateBrief(brief);

                DialogService.Close(brief);
            }
            catch (System.Exception localhostCreateBriefException)
            {
                NotificationService.Notify(new NotificationMessage()
                {
                    Severity = NotificationSeverity.Error, Summary = $"Error", Detail = $"Unable to create new Brief!"
                });
            }
        }
Ejemplo n.º 7
0
        protected async System.Threading.Tasks.Task Form0Submit(Flashcardgenerator.Models.Localhost.Brief args)
        {
            try
            {
                var localhostUpdateBriefResult = await Localhost.UpdateBrief(briefId, brief);

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

                hasChanges = localhostUpdateBriefException is DbUpdateConcurrencyException;
            }
        }
        public async Task <Models.Localhost.Brief> UpdateBrief(int?briefId, Models.Localhost.Brief brief)
        {
            OnBriefUpdated(brief);

            var itemToUpdate = Context.Briefs
                               .Where(i => i.briefId == briefId)
                               .FirstOrDefault();

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

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

            OnAfterBriefUpdated(brief);

            return(brief);
        }
Ejemplo n.º 9
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;
        }
 partial void OnAfterBriefUpdated(Models.Localhost.Brief item);
 partial void OnBriefGet(Models.Localhost.Brief item);
 partial void OnBriefDeleted(Models.Localhost.Brief item);
 partial void OnBriefCreated(Models.Localhost.Brief item);