public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description")] Product product) { if (id != product.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(product); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(product.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(product)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ProductId,TagId")] ProductTag productTag) { if (id != productTag.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(productTag); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductTagExists(productTag.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ProductId"] = new SelectList(_context.Products, "Id", "Description", productTag.ProductId); ViewData["TagId"] = new SelectList(_context.Tags, "Id", "Name", productTag.TagId); return(View(productTag)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Phone,Address")] Customer customer) { if (id != customer.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Site")] Delivery delivery) { if (id != delivery.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(delivery); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeliveryExists(delivery.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(delivery)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ProductId,CustomerId,DeliveryId,Time")] Order order) { if (id != order.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(order); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderExists(order.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customers, "Id", "Address", order.CustomerId); ViewData["DeliveryId"] = new SelectList(_context.Deliveries, "Id", "Name", order.DeliveryId); ViewData["ProductId"] = new SelectList(_context.Products, "Id", "Description", order.ProductId); return(View(order)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,StreetAddress,ZipCode,City,Country,Ssn,PhoneNumber1,PhoneNumber2,Email")] Person person) { if (id != person.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(person); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonExists(person.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(IndexSearch))); } return(View(person)); }
public async Task <IActionResult> PutDettaglioPre(string idStr, int idPre, [FromBody] JObject data) { var pos = data["PosizioneRiconsegna"].ToObject <string>(); var strumento = await _context.Strumento.FindAsync(idStr); _context.Update(strumento); strumento.Posizione = pos; var dettaglio = _context.DettaglioPrenotazione.Where(dp => dp.IdPrenotazione == idPre && dp.IdStrumento == idStr).FirstOrDefault(); dettaglio.OreUtilizzo = data["OreUtilizzo"].ToObject <int>(); dettaglio.PosizioneRiconsegna = pos; dettaglio.Progetto = data["Progetto"].ToObject <string>(); dettaglio.Reparto = data["Reparto"].ToObject <string>(); _context.Update(dettaglio); await _context.SaveChangesAsync(); return(Ok()); }