Example #1
0
        public async Task <IActionResult> PutStudio(int id, Studio studio)
        {
            if (id != studio.Id)
            {
                return(BadRequest());
            }

            _context.Entry(studio).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StudioExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #2
0
        public async Task <IActionResult> PutIsRented(int id, bool rented, Rented rent)
        {
            if (id != rent.Id)
            {
                return(BadRequest());
            }
            _context.Entry(rent).State   = EntityState.Modified;
            _context.Entry(rented).State = EntityState.Modified;
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RentedExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #3
0
        public async Task <IActionResult> PutTrivias(int id, Trivias trivias)
        {
            if (id != trivias.Id)
            {
                return(BadRequest());
            }

            _context.Entry(trivias).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TriviasExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #4
0
        public async Task <IActionResult> Create([Bind("Id,Title,Genre,Stock")] Movie movie)
        {
            if (ModelState.IsValid)
            {
                _context.Add(movie);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(movie));
        }
Example #5
0
        public async Task <IActionResult> Create([Bind("Id,Name,Ort")] Studio studio)
        {
            if (ModelState.IsValid)
            {
                _context.Add(studio);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(studio));
        }
Example #6
0
        public async Task <IActionResult> Create([Bind("Id,Title")] Trivias trivias)
        {
            if (ModelState.IsValid)
            {
                _context.Add(trivias);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(trivias));
        }
Example #7
0
        public async Task <IActionResult> Create([Bind("Id,Grade,MovieId")] Review review)
        {
            if (ModelState.IsValid)
            {
                _context.Add(review);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MovieId"] = new SelectList(_context.Movies, "Id", "Title", review.MovieId);
            return(View(review));
        }