예제 #1
0
        //GET: Checked in/Checked out//Added by ME today 9/6
        public async Task <IActionResult> CheckOut(int?id) //USE THIS !
        {
            var movieModel = await _context.MovieModel     //using id to find the movie
                             .SingleOrDefaultAsync(m => m.Id == id);

            // Update that movie as checkedout
            movieModel.CheckedOut = true;

            _context.Update(movieModel);
            await _context.SaveChangesAsync();

            // Then redirect them back to the list of movies
            return(RedirectToAction(nameof(Index)));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,RentalID,MovieID,CustomerID,RentalDate,DueDate,ReturnDate")] RentalRecordModel rentalRecordModel)
        {
            if (id != rentalRecordModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(rentalRecordModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RentalRecordModelExists(rentalRecordModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(rentalRecordModel));
        }
예제 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CustomerName,CustomerPhone")] CustomerModel customerModel)
        {
            if (id != customerModel.Id)
            {
                return(NotFound());
            }

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