public async Task <IActionResult> Create([Bind("ID,Titulo,FechaLanzamiento,Genero,Precio")] Movie movie) { if (ModelState.IsValid) { _context.Add(movie); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(movie)); }
public async Task <IActionResult> Create([Bind("ID,Title,ReleaseDate,Genre,Price,Rating")] Movie movie) { if (ModelState.IsValid) { _context.Add(movie); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(movie)); }
public async Task <IActionResult> Create([Bind("Id,Name")] Genre genre) { if (ModelState.IsValid) { genre.Id = Guid.NewGuid(); _context.Add(genre); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(genre)); }
public async Task <IActionResult> Create([Bind("Id,Name,SexId,Birthday,Obit,Nationality,Größe,Gewicht,PersonTypesId")] Person person) { if (ModelState.IsValid) { person.Id = Guid.NewGuid(); _context.Add(person); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PersonTypesId"] = new SelectList(_context.PersonType, "Id", "Name", person.PersonTypesId); ViewData["SexId"] = new SelectList(_context.Sex, "Id", "Name", person.SexId); return(View(person)); }
public async Task <IActionResult> Create([Bind("Id,Name,YearOfPublication,GenreId,RecordCarrierId,InStock,StorageLocationId,Added,OnWatch,Remark,Adult,ThreeD,Owner,IMDB,Ranking,LastView")] Movies movies) { if (ModelState.IsValid) { movies.Id = Guid.NewGuid(); _context.Add(movies); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["GenreId"] = new SelectList(_context.Genre.OrderBy(o => o.Name), "Id", "Name", movies.GenreId); ViewData["RecordCarrierId"] = new SelectList(_context.RecordCarrier.OrderBy(o => o.Name), "Id", "Name", movies.RecordCarrierId); ViewData["StorageLocationId"] = new SelectList(_context.StorageLocation.OrderBy(o => o.Name), "Id", "Name", movies.StorageLocationId); return(View(movies)); }
public async Task <ActionResult> Edit(Guid id, [Bind("Id,Name,PersonId")] PersonTypes personTypes) { if (id != personTypes.Id) { return(NotFound()); } if (ModelState.IsValid) { try { using (var ctx = new MvcMovieCoreContext()) { ctx.Update(personTypes); await ctx.SaveChangesAsync(); } } catch (DbUpdateConcurrencyException) { if (!PersonTypeExists(personTypes.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PersonId"] = new SelectList(new MvcMovieCoreContext().Person, "Id", "Name"); return(View(personTypes)); }
public async Task <ActionResult> DeleteConfirmed(Guid id) { using (var ctx = new MvcMovieCoreContext()) { var personType = await ctx.PersonType.FindAsync(id); ctx.PersonType.Remove(personType); await ctx.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } }
public async Task <ActionResult> Create([Bind("Id,Name,PersonId")] PersonTypes personTypes) { using (var ctx = new MvcMovieCoreContext()) { if (ModelState.IsValid) { personTypes.Id = Guid.NewGuid(); ctx.Add(personTypes); await ctx.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PersonId"] = new SelectList(ctx.Person, "Id", "Name"); return(View()); } }