public ActionResult Edit([Bind(Include = "ID, Brand, Supplier_autoID, price, EquipmentID, StaffID")] Car Cl)
 {
     if (ModelState.IsValid)
     {
         db.Entry(Cl).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("/"));
     }
     return(View(Cl));
 }
 public ActionResult Edit([Bind(Include = "ID, fname, lname, RoleID, Type_roomID")] Staff Cl)
 {
     if (ModelState.IsValid)
     {
         db.Entry(Cl).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("/"));
     }
     return(View(Cl));
 }
Ejemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "ID,type")] Accessory Cl)
 {
     if (ModelState.IsValid)
     {
         db.Entry(Cl).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("/"));
     }
     return(View(Cl));
 }
Ejemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "ID, date, StaffID")] Supplier_auto Cl)
 {
     if (ModelState.IsValid)
     {
         db.Entry(Cl).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("/"));
     }
     return(View(Cl));
 }
 public ActionResult Edit([Bind(Include = "ID, fname, lname, phone, CarID")] Client Cl)
 {
     if (ModelState.IsValid)
     {
         db.Entry(Cl).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("/"));
     }
     return(View(Cl));
 }
Ejemplo n.º 6
0
        public IHttpActionResult PutVehicle(int id, string make = null, string model = null, int?year = null, string color = null)
        {
            Vehicle v = db.Vehicles.Find(id);

            if (v != null)
            {
                if (make != null)
                {
                    v.make = make;
                }
                if (model != null)
                {
                    v.model = model;
                }
                if (year != null)
                {
                    v.year = year;
                }
                if (color != null)
                {
                    v.color = color;
                }
                try
                {
                    db.Vehicles.AddOrUpdate(v);
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VehicleExists(id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                v = db.Vehicles.Find(id);
                return(StatusCode(HttpStatusCode.OK));
            }
            return(NotFound());
        }