Esempio n. 1
0
        public async Task <IActionResult> PutFilmText(short id, FilmText filmText)
        {
            if (id != filmText.FilmId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 2
0
 public async Task<IActionResult> Create([Bind("AddressId,Address1,Address2,District,CityId,PostalCode,Phone,LastUpdate")] Address address)
 {
     if (ModelState.IsValid)
     {
         _context.Add(address);
         await _context.SaveChangesAsync();
         return RedirectToAction(nameof(Index));
     }
     ViewData["CityId"] = new SelectList(_context.City, "CityId", "City1", address.CityId);
     return View(address);
 }
        public async Task <IActionResult> Create([Bind("ActorId,FirstName,LastName,LastUpdate")] Actor actor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(actor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(actor));
        }
Esempio n. 4
0
        public async Task <IActionResult> Create([Bind("CustomerId,StoreId,FirstName,LastName,Email,AddressId,Active,CreateDate,LastUpdate")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AddressId"] = new SelectList(_context.Address, "AddressId", "Address1", customer.AddressId);
            ViewData["StoreId"]   = new SelectList(_context.Store, "StoreId", "StoreId", customer.StoreId);
            return(View(customer));
        }
        public async Task <IActionResult> Create([Bind("FilmId,Title,Description,ReleaseYear,LanguageId,OriginalLanguageId,RentalDuration,RentalRate,Length,ReplacementCost,Rating,SpecialFeatures,LastUpdate")] Film film)
        {
            if (ModelState.IsValid)
            {
                _context.Add(film);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LanguageId"]         = new SelectList(_context.Language, "LanguageId", "Name", film.LanguageId);
            ViewData["OriginalLanguageId"] = new SelectList(_context.Language, "LanguageId", "Name", film.OriginalLanguageId);
            return(View(film));
        }
Esempio n. 6
0
        public async Task <IActionResult> Create([Bind("RentalId,RentalDate,InventoryId,CustomerId,ReturnDate,StaffId,LastUpdate")] Rental rental)
        {
            if (ModelState.IsValid)
            {
                _context.Add(rental);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"]  = new SelectList(_context.Customer, "CustomerId", "Active", rental.CustomerId);
            ViewData["InventoryId"] = new SelectList(_context.Inventory, "InventoryId", "InventoryId", rental.InventoryId);
            ViewData["StaffId"]     = new SelectList(_context.Staff, "StaffId", "FirstName", rental.StaffId);
            return(View(rental));
        }