示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,webSectionID,UploadID,Title,Body,Caption,sOrder,featuredCode,newsDate,startOn,endOn,isGlobal")] NEWs nEWs)
        {
            if (id != nEWs.NewsID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(nEWs);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NEWsExists(nEWs.NewsID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(nEWs));
        }
示例#2
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            var fAQ = await _context.faq.FindAsync(id);

            _context.faq.Remove(fAQ);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }