Пример #1
0
        public void Edit(Customer customer)
        {
            var entry = db.Entry(customer);

            entry.State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
        public void Edit(Part part)
        {
            var entry = db.Entry(part);

            entry.State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
Пример #3
0
        public void Edit(Employee employee)
        {
            var entry = db.Entry(employee);

            entry.State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
Пример #4
0
 public void Edit(Order order)
 {
     try
     {
         var entry2 = db.Entry(order);
         entry2.State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
     catch (InvalidOperationException)
     {
         Order toEdit = db.Orders.Find(order.Id);
         var   entry  = db.Entry(toEdit);
         entry.State        = System.Data.Entity.EntityState.Modified;
         toEdit.CustomerId  = order.CustomerId;
         toEdit.Description = order.Description;
         toEdit.EmployeeId  = order.EmployeeId;
         toEdit.EndDate     = order.EndDate;
         toEdit.StartDate   = order.StartDate;
         toEdit.StatusId    = order.StatusId;
         toEdit.HoursWorked = order.HoursWorked;
         db.SaveChanges();
     }
 }