public ActionResult Create([Bind(Include = "no,name,tables,cur,after15min")] tb_room tb_room)
 {
     if (ModelState.IsValid)
     {
         db.tb_room.Add(tb_room);
         for (int i = 0; i < tb_room.tables * 4; i++)
         {
             tb_seat seat = new tb_seat()
             {
                 no = i, anyone = false, available = true, room = tb_room.no, seat = (short)(i % 4), desk = i / 4
             };
             db.tb_seat.Add(seat);
         }
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tb_room));
 }
 public ActionResult Edit([Bind(Include = "no,name,tables,cur,after15min")] tb_room tb_room)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tb_room).State = EntityState.Modified;
         db.tb_seat_student.RemoveRange(db.tb_seat_student.Where(m => m.room == tb_room.no));
         db.tb_seat.RemoveRange(db.tb_seat.Where(m => m.room == tb_room.no));
         for (int i = 0; i < tb_room.tables * 4; i++)
         {
             tb_seat seat = new tb_seat()
             {
                 no = i, anyone = false, available = true, room = tb_room.no, seat = (short)(i % 4), desk = i / 4
             };
             db.tb_seat.Add(seat);
         }
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tb_room));
 }