public async Task <IActionResult> Edit(int id, [Bind("IdPrenotazione,Data,IdAspNetUsers,IdPostazione")] Prenotazione prenotazione)
        {
            if (id != prenotazione.IdPrenotazione)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(prenotazione);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PrenotazioneExists(prenotazione.IdPrenotazione))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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> Edit(string id, ApplicationUser utente)
        {
            if (id != utente.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    var aspnetusers = _context.AspNetUsers.Single(u => u.Id.Equals(id));
                    aspnetusers.FirstName = utente.FirstName;
                    aspnetusers.LastName  = utente.LastName;
                    aspnetusers.Email     = utente.Email;
                    _context.Update(aspnetusers);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ApplicationUserExists(utente.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(utente));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdArticolo,NomeArticolo,Descrizione")] Articolo articolo)
        {
            if (id != articolo.IdArticolo)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(articolo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ArticoloExists(articolo.IdArticolo))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(articolo));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdVersamento,PezziBuoni,PezziDifettosi,Data,TempoProd,IdComponente,IdNomeStazione,IdAspNetUsers")] Versamento versamento)
        {
            if (id != versamento.IdVersamento)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(versamento);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VersamentoExists(versamento.IdVersamento))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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> Edit(int id, [Bind("IdNomeStazione,NomeStazione,IdLinea")] Stazione stazione)
        {
            if (id != stazione.IdNomeStazione)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(stazione);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StazioneExists(stazione.IdNomeStazione))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdLinea"] = new SelectList(_context.Linee, "IdLinea", "NomeLinea", stazione.IdLinea);
            return(View(stazione));
        }
Пример #6
0
        public async Task <IActionResult> Put(int id, [FromBody] Linea linea)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != linea.IdLinea)
            {
                return(BadRequest());
            }

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

            return(this.Ok(linea));
        }
Пример #7
0
        public async Task <IActionResult> Edit(int id, [Bind("IdPostazione,NomePostazione,Descrizione")] Postazione postazione)
        {
            if (id != postazione.IdPostazione)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(postazione);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PostazioneExists(postazione.IdPostazione))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(postazione));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdLinea,NomeLinea")] Linea linea)
        {
            if (id != linea.IdLinea)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(linea);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LineaExists(linea.IdLinea))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(linea));
        }
Пример #9
0
        public async Task <IActionResult> Edit(int id, [Bind("IdComponente,NomeComponente,TempoProduzione,IdArticolo")] ComponenteArticolo componenteArticolo)
        {
            if (id != componenteArticolo.IdComponente)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(componenteArticolo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ComponenteArticoloExists(componenteArticolo.IdComponente))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdArticolo"] = new SelectList(_context.Articoli, "IdArticolo", "NomeArticolo", componenteArticolo.IdArticolo);
            return(View(componenteArticolo));
        }
Пример #10
0
        public async Task <IActionResult> Edit(int id, News news)
        {
            if (id != news.NewsId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(news);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NewsExists(news.NewsId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(news));
        }