Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("VideoID,Name,Url,Level,PreReqs,Description,IsActive")] LyraVideos lyraVideos)
        {
            if (id != lyraVideos.VideoID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(lyraVideos);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LyraVideosExists(lyraVideos.VideoID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(lyraVideos));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("VideoID,Name,Url,Level,PreReqs,Description,IsActive")] LyraVideos lyraVideos)
        {
            if (ModelState.IsValid)
            {
                _context.Add(lyraVideos);
                await _context.SaveChangesAsync();

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