public async Task <IActionResult> Create([Bind("ID,StreetNumber,StreetName,City,State,PostalCode,Phone")] Address address) { if (ModelState.IsValid) { _context.Add(address); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(address)); }
public async Task <IActionResult> Create([Bind("ID,SSN,FirstName,LastName")] Musician musician) { if (ModelState.IsValid) { _context.Add(musician); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(musician)); }
public async Task <IActionResult> Create([Bind("ID,Key")] Song song) { if (ModelState.IsValid) { _context.Add(song); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(song)); }
public async Task <IActionResult> Create([Bind("ID")] Album album) { if (ModelState.IsValid) { album.ID = Guid.NewGuid(); _context.Add(album); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(album)); }
public async Task <IActionResult> Create([Bind("ID,MusicianID,SongID,Instrument")] Performance performance) { if (ModelState.IsValid) { _context.Add(performance); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["MusicianID"] = new SelectList(_context.Musicians, "ID", "Discriminator", performance.MusicianID); ViewData["SongID"] = new SelectList(_context.Songs, "ID", "ID", performance.SongID); return(View(performance)); }
public async Task <IActionResult> Create([Bind("FaixaID, Nome, Autor, DataLancamento,Volume ")] Faixa faixa) { try { if (ModelState.IsValid) { _context.Add(faixa); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } } catch (DbUpdateException) { ModelState.AddModelError("", "Não foi possível inserir dados."); } return(View(faixa)); }
public async Task <IActionResult> Create([Bind(" MusicoId,Nome, Telefone, Endereço, Numero, Estado, Cidade, Bairro")] Musico musico) { try { if (ModelState.IsValid) { _context.Add(musico); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Indexmusico))); } } catch (DbUpdateException) { ModelState.AddModelError("", "Não foi possível inserir dados."); } return(View(musico)); }
public async Task <IActionResult> Create([Bind("InstrumentoID, Nome, Marca, Modelo, Serie, Cor ")] Instrumento instrumento) { try { if (ModelState.IsValid) { _context.Add(instrumento); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(IndexInstrumento))); } } catch (DbUpdateException) { ModelState.AddModelError("", "Não foi possível inserir dados."); } return(View(instrumento)); }
public async Task <IActionResult> CreateAlbum([Bind("AlbumID, Nome, DataAlbum, Formato,Foto,Genero")] Album album) { try { if (ModelState.IsValid) { _context.Add(album); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(IndexAlbum))); } } catch (DbUpdateException) { ModelState.AddModelError("", "Não foi possível inserir dados."); } return(View(album)); }