Example #1
0
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            // Update the modified date on save
            ScriptureRecord.ModifiedDate = DateTime.UtcNow;

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(ScriptureRecord).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ScriptureRecordExists(ScriptureRecord.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Example #2
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ScriptureRecord = await _context.ScriptureRecord.FindAsync(id);

            if (ScriptureRecord != null)
            {
                _context.ScriptureRecord.Remove(ScriptureRecord);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Example #3
0
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            // Add the created date and modified date on save
            DateTime currTime = DateTime.UtcNow;

            ScriptureRecord.CreatedDate  = currTime;
            ScriptureRecord.ModifiedDate = currTime;

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.ScriptureRecord.Add(ScriptureRecord);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }