public async Task <IActionResult> PutTuner([FromRoute] string id, [FromBody] Tuner tuner)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tuner.Id)
            {
                return(BadRequest());
            }

            _context.Entry(tuner).State = EntityState.Modified;

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

            return(NoContent());
        }
 public ActionResult Edit([Bind(Include = "id,name,email")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
        public async Task <ActionResult> Edit([Bind(Include = "id,item,price,qty")] RestaurantMenu restaurantMenu)
        {
            if (ModelState.IsValid)
            {
                db.Entry(restaurantMenu).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(restaurantMenu));
        }
Exemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "id,custID,orderDate")] Order order)
 {
     if (ModelState.IsValid)
     {
         db.Entry(order).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.custID = new SelectList(db.Customers, "id", "name", order.custID);
     return(View(order));
 }
 public ActionResult Edit([Bind(Include = "rentID,menuID,qtyOrdered,orderDueDate")] OrderDetails orderDetails)
 {
     if (ModelState.IsValid)
     {
         db.Entry(orderDetails).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.menuID = new SelectList(db.RestaurantMenus, "id", "item", orderDetails.menuID);
     ViewBag.rentID = new SelectList(db.Orders, "id", "id", orderDetails.rentID);
     return(View(orderDetails));
 }