예제 #1
0
        public IHttpActionResult PutCustomer(int id, Customer customer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #2
0
 public void Update(CompanySize entity)
 {
     context.Entry(entity).State = EntityState.Modified;
     context.SaveChanges();
 }
예제 #3
0
 public void Update(Customer entity)
 {
     context.Entry(entity).State = EntityState.Modified;
     context.SaveChanges();
 }