Пример #1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AlbumExists(Album.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                ViewData["AlbumId"]    = new SelectList(_context.Albums, "Id", "Name");
                ViewData["ProducerId"] = new SelectList(_context.Producers, "Id", "Name");
                ViewData["StudioId"]   = new SelectList(_context.Studios, "Id", "Name");
                return(Page());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MovieExists(Movie.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Пример #3
0
        public async Task<IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return Page();
            }

            _context.Albums.Add(Album);
            await _context.SaveChangesAsync();

            return RedirectToPage("./Index");
        }
Пример #4
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Producers.Add(Producer);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Пример #5
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                ViewData["AlbumId"]    = new SelectList(_context.Albums, "Id", "Name");
                ViewData["ProducerId"] = new SelectList(_context.Producers, "Id", "Name");
                ViewData["StudioId"]   = new SelectList(_context.Studios, "Id", "Name");
                return(Page());
            }

            _context.Movies.Add(Movie);
            await _context.SaveChangesAsync();

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

            Album = await _context.Albums.FindAsync(id);

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

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

            GoodMovie = await _context.GoodMovies.FindAsync(id);

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

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