コード例 #1
0
 public static bool Modify(ServicesView s)
 {
     try
     {
         db = new AceEntities();
         Services services = new Services
         {
             Name  = s.Name,
             Price = s.Price
         };
         db.Services.Attach(services);
         db.Entry(services).State = EntityState.Modified;
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #2
0
 public static bool Modify(RoomView r)
 {
     try
     {
         db = new AceEntities();
         Room room = new Room
         {
             IdEmp = r.EmpID,
             Name  = Convert.ToInt32(r.Name.Trim()),
             Price = r.Price,
         };
         db.Room.Attach(room);
         db.Entry(room).State = EntityState.Modified;
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #3
0
 public static bool Modify(AccountView acc)
 {
     try
     {
         db = new AceEntities();
         Account account = new Account
         {
             Name     = acc.Name,
             Email    = acc.Email,
             Address  = acc.Address,
             Password = acc.Password,
             Phone    = acc.Phone,
             Roles    = acc.Role
         };
         db.Account.Attach(account);
         db.Entry(account).State = EntityState.Modified;
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }