Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Title,Sermon,url,HgrmDataID")] hgrmWrittenMessage hgrmWrittenMessage)
        {
            if (id != hgrmWrittenMessage.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(hgrmWrittenMessage);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!hgrmWrittenMessageExists(hgrmWrittenMessage.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["HgrmDataID"] = new SelectList(_context.HgrmData, "ID", "ID", hgrmWrittenMessage.HgrmDataID);
            return(View(hgrmWrittenMessage));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("ID,Title,Sermon,url,HgrmDataID")] hgrmWrittenMessage hgrmWrittenMessage)
        {
            if (ModelState.IsValid)
            {
                _context.Add(hgrmWrittenMessage);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["HgrmDataID"] = new SelectList(_context.HgrmData, "ID", "ID", hgrmWrittenMessage.HgrmDataID);
            return(View(hgrmWrittenMessage));
        }