public async Task <IActionResult> PutSchool([FromRoute] Guid id, [FromBody] School school) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != school.SchoolId) { return(BadRequest()); } _context.Entry(school).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SchoolExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit([Bind(Include = "id,Firstname,Lastname,Phone,Email,Address,City,State,Zip")] Customer customer) { if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customer)); }
public ActionResult Edit([Bind(Include = "Id,Description,Cost,Downpayment,PaidinFull,CustomerId,DateAdded,DateCompleted")] Order order) { if (ModelState.IsValid) { db.Entry(order).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CustomerId = new SelectList(db.Customers, "id", "Firstname", order.CustomerId); return(View(order)); }