Exemplo n.º 1
0
        public IHttpActionResult PutCustomer(int id, Customer customer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != customer.CustomerId)
            {
                return(BadRequest());
            }

            db.Entry(customer).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CustomerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "CarrierID,MCNumber,DOTNumber,Address1,Address2,City,StateID,Zip,Email,WebURL,Active,DateCreated,LastModified")] Carrier carrier)
 {
     if (ModelState.IsValid)
     {
         db.Entry(carrier).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.StateID = new SelectList(db.States, "StateID", "StateName", carrier.StateID);
     return(View(carrier));
 }
Exemplo n.º 3
0
        public ActionResult Edit(int id, TestEmployee model)
        {
            using (PracticeDBEntities db = new PracticeDBEntities())
            {
                Employee employee = new Employee();
                employee.Eno    = model.Eno;
                employee.Ename  = model.Ename;
                employee.Job    = model.Job;
                employee.Salary = model.Salary;
                employee.Dname  = model.Dname;

                db.Entry(employee).State = EntityState.Modified;
                db.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }