public void Delete(int id)
 {
     using (ReservContext db = new ReservContext())
     {
         var user = db.Users.FirstOrDefault <User>(u => u.Id == id);
         db.Users.Remove(user);
         db.SaveChanges();
     }
 }
 public void Edit(UserModel model)
 {
     using (ReservContext db = new ReservContext())
     {
         var user_edit = db.Users.Where(i => i.Id == model._Id).FirstOrDefault();
         user_edit.Name     = model._FirstName;
         user_edit.LastName = model._LastName;
         db.SaveChanges();
     }
 }
 public IQueryable GetUsersWithChar(char firstInitial)
 {
     using (ReservContext db = new ReservContext())
     {
         var user = db.Users.Where <User>
                        (u => u.Name.Contains(firstInitial));
         db.SaveChanges();
         return(user);
     }
 }
 public void Edit(RoomModel model)
 {
     using (ReservContext db = new ReservContext())
     {
         var room_edit = db.Rooms.Where(i => i.Id == model._Id).FirstOrDefault();
         room_edit.Price  = model._Price;
         room_edit.RoomId = model._InnerId;
         db.SaveChanges();
         //db.Entry(room_edit).State = EntityState.Modified;
     }
 }
 public void Add(User user)
 {
     if (user.Name.Length >= 3 && user.LastName.Length >= 3)
     {
         using (ReservContext db = new ReservContext())
         {
             db.Users.Add(user);
             db.SaveChanges();
         }
     }
 }
 public void ChangeName(string fName, string lName, int id)
 {
     if (fName.Length >= 3 && lName.Length >= 3)
     {
         using (ReservContext db = new ReservContext())
         {
             var user = db.Users.FirstOrDefault <User>(u => u.Id == id);
             if (user != null)
             {
                 user.Name     = fName;
                 user.LastName = lName;
             }
             db.SaveChanges();
         }
     }
 }