Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Format,LengthTime,Id,Name,Path,Width,Height")] Video video)
        {
            if (id != video.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(video);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VideoExists(video.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(video));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,Title,MediaType,Format,Duration,Genre,Year,Rating,Location,Notes")] Media media)
        {
            if (id != media.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(media);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MediaExists(media.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(media));
        }