public async Task <IActionResult> Create([Bind("CountryId,Country1,LastUpdate")] Country country) { if (ModelState.IsValid) { _context.Add(country); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(country)); }
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)); }
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))); } return(View(film)); }
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("CityId,City1,CountryId,LastUpdate")] City city) { if (ModelState.IsValid) { _context.Add(city); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CountryId"] = new SelectList(_context.Country, "CountryId", "Country1", city.CountryId); return(View(city)); }
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,LanguageId,OriginalLanguageId,RentalDuration,RentalRate,Length,ReplacementCost,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)); }
public async Task <IActionResult> Create([Bind("ActorId,FilmId,LastUpdate")] FilmActor filmActor) { if (ModelState.IsValid) { _context.Add(filmActor); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ActorId"] = new SelectList(_context.Actor, "ActorId", "FirstName", filmActor.ActorId); ViewData["FilmId"] = new SelectList(_context.Film, "FilmId", "Title", filmActor.FilmId); return(View(filmActor)); }
public async Task <IActionResult> Create([Bind("StaffId,FirstName,LastName,AddressId,Picture,Email,StoreId,Active,Username,Password,LastUpdate")] Staff staff) { if (ModelState.IsValid) { _context.Add(staff); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AddressId"] = new SelectList(_context.Address, "AddressId", "Address1", staff.AddressId); ViewData["StoreId"] = new SelectList(_context.Store, "StoreId", "StoreId", staff.StoreId); return(View(staff)); }
public async Task <IActionResult> Create([Bind("PaymentId,CustomerId,StaffId,RentalId,Amount,PaymentDate,LastUpdate")] Payment payment) { if (ModelState.IsValid) { _context.Add(payment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customer, "CustomerId", "Active", payment.CustomerId); ViewData["RentalId"] = new SelectList(_context.Rental, "RentalId", "RentalId", payment.RentalId); ViewData["StaffId"] = new SelectList(_context.Staff, "StaffId", "FirstName", payment.StaffId); return(View(payment)); }