public async Task <IActionResult> Create([Bind("IdPostazione,NomePostazione,Descrizione")] Postazione postazione) { if (ModelState.IsValid) { _context.Add(postazione); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(postazione)); }
public async Task <IActionResult> Create([Bind("IdArticolo,NomeArticolo,Descrizione")] Articolo articolo) { if (ModelState.IsValid) { _context.Add(articolo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(articolo)); }
public async Task <IActionResult> Create([Bind("IdLinea,NomeLinea")] Linea linea) { if (ModelState.IsValid) { _context.Add(linea); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(linea)); }
public async Task <IActionResult> Create(News news) { if (ModelState.IsValid) { _context.Add(news); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(news)); }
public async Task <IActionResult> Create([Bind("IdNomeStazione,NomeStazione,IdLinea")] Stazione stazione) { if (ModelState.IsValid) { _context.Add(stazione); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IdLinea"] = new SelectList(_context.Linee, "IdLinea", "NomeLinea", stazione.IdLinea); return(View(stazione)); }
public async Task <IActionResult> Create([Bind("IdComponente,NomeComponente,TempoProduzione,IdArticolo")] ComponenteArticolo componenteArticolo) { if (ModelState.IsValid) { _context.Add(componenteArticolo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IdArticolo"] = new SelectList(_context.Articoli, "IdArticolo", "NomeArticolo", componenteArticolo.IdArticolo); return(View(componenteArticolo)); }
public async Task <IActionResult> Create([Bind("IdPrenotazione,Data,IdAspNetUsers,IdPostazione")] Prenotazione prenotazione) { if (ModelState.IsValid) { _context.Add(prenotazione); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IdAspNetUsers"] = new SelectList(_context.AspNetUsers, "Id", "Email", prenotazione.IdAspNetUsers); ViewData["IdPostazione"] = new SelectList(_context.Postazioni, "IdPostazione", "NomePostazione", prenotazione.IdPostazione); return(View(prenotazione)); }
public async Task <IActionResult> Create([Bind("IdVersamento,PezziBuoni,PezziDifettosi,Data,TempoProd,IdComponente,IdNomeStazione,IdAspNetUsers")] Versamento versamento) { if (ModelState.IsValid) { _context.Add(versamento); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IdAspNetUsers"] = new SelectList(_context.AspNetUsers, "Id", "Email", versamento.IdAspNetUsers); ViewData["IdComponente"] = new SelectList(_context.ComponentiArticolo, "IdComponente", "NomeComponente", versamento.IdComponente); ViewData["IdNomeStazione"] = new SelectList(_context.Stazioni, "IdNomeStazione", "NomeStazione", versamento.IdNomeStazione); return(View(versamento)); }
public async Task <IActionResult> Create(ApplicationUser utente) { ApplicationUser user = new ApplicationUser { UserName = utente.Email, Email = utente.Email, FirstName = utente.FirstName, LastName = utente.LastName }; if (ModelState.IsValid) { _context.Add(utente); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(utente)); }
public async Task <IActionResult> Post([FromBody] ApplicationUser utente) { ApplicationUser user = new ApplicationUser { UserName = utente.Email, Email = utente.Email, FirstName = utente.FirstName, LastName = utente.LastName }; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Add(utente); await _context.SaveChangesAsync(); return(this.Ok(utente)); }