Example #1
0
        protected async Task UpdateDevotionAsync(DevotionsViewModel model)
        {
            // Get the devotion to update...
            var devotion = await Context.Devotions.FindAsync(model.Id);

            // Set new data
            devotion.Date                 = model.Date;
            devotion.Title                = model.Title;
            devotion.AnchorScripture      = model.AnchorScripture;
            devotion.FurtherReading       = model.FurtherReading;
            devotion.TextQuote            = model.TextQuote;
            devotion.FirstTextParagraph   = model.FirstTextParagraph;
            devotion.SecondTextParagraph  = model.SecondTextParagraph;
            devotion.ThirdTextParagraph   = model.ThirdTextParagraph;
            devotion.ImageUrl             = model.ImageUrl.Substring(12);
            devotion.MemoryVerse          = model.MemoryVerse;
            devotion.PrayerPoint          = model.PrayerPoint;
            devotion.PropheticDeclaration = model.PropheticDeclaration;

            // Update...
            Context.Devotions.Update(devotion);

            // Save changes
            await Context.SaveChangesAsync();

            // Clear entry data
            devotion.Title                = string.Empty;
            devotion.AnchorScripture      = string.Empty;
            devotion.FurtherReading       = string.Empty;
            devotion.TextQuote            = string.Empty;
            devotion.FirstTextParagraph   = string.Empty;
            devotion.SecondTextParagraph  = string.Empty;
            devotion.ThirdTextParagraph   = string.Empty;
            devotion.ImageUrl             = string.Empty;
            devotion.PrayerPoint          = string.Empty;
            devotion.MemoryVerse          = string.Empty;
            devotion.PropheticDeclaration = string.Empty;

            // Flash that the operation was successful
            FlashDevotionModifiedSuccess = true;

            // Drop the dialog
            ShowingDevotionModifyConfirmationDialog = false;

            NavigationManager.NavigateTo("/devotions");
        }
Example #2
0
        /// <summary>
        /// The command to add a new devotion
        /// </summary>
        /// <param name="devotions">The specified devotion properties</param>
        /// <returns></returns>
        protected async Task AddDevotionAsync(DevotionsViewModel model)
        {
            // Assign the values
            var devotion = new DevotionsDataModel
            {
                Id                   = Guid.NewGuid().ToString("N"),
                Date                 = model.Date,
                Title                = model.Title,
                AnchorScripture      = model.AnchorScripture,
                TextQuote            = model.TextQuote,
                FirstTextParagraph   = model.FirstTextParagraph,
                SecondTextParagraph  = model.SecondTextParagraph,
                ThirdTextParagraph   = model.ThirdTextParagraph,
                FurtherReading       = model.FurtherReading,
                MemoryVerse          = model.MemoryVerse,
                PrayerPoint          = model.PrayerPoint,
                PropheticDeclaration = model.PropheticDeclaration,
                ImageUrl             = model.ImageUrl.Substring(12)
            };

            // Add the record
            await Context.Devotions.AddAsync(devotion);

            // Commit changes to database
            await Context.SaveChangesAsync();

            // Clear entry data
            Devotions.Title                = string.Empty;
            Devotions.AnchorScripture      = string.Empty;
            Devotions.FurtherReading       = string.Empty;
            Devotions.TextQuote            = string.Empty;
            Devotions.FirstTextParagraph   = string.Empty;
            Devotions.SecondTextParagraph  = string.Empty;
            Devotions.ThirdTextParagraph   = string.Empty;
            Devotions.ImageUrl             = string.Empty;
            Devotions.PrayerPoint          = string.Empty;
            Devotions.MemoryVerse          = string.Empty;
            Devotions.PropheticDeclaration = string.Empty;

            // Flash that the operation was successful
            FlashDevotionAddedSuccess = true;

            // Drop the dialog
            ShowingDevotionEntryConfirmationDialog = false;
        }
Example #3
0
 /// <summary>
 /// The command to review the just added devotion
 /// </summary>
 /// <param name="devotions">The specified devotion</param>
 /// <returns></returns>
 protected async Task GoToDevotionAsync(DevotionsViewModel devotions)
 {
 }