Exemplo n.º 1
0
        public ActionResult Edit(StuRoom room, int id)
        {
            Entity.Entry(room).State = EntityState.Modified;
            Entity.SaveChanges();

            return(RedirectToAction("Manage"));
        }
Exemplo n.º 2
0
        public ActionResult Add(StuRoom room)
        {
            room.AddTime    = DateTime.Now;
            room.Empty_Seat = room.SeatNum;
            room.State      = "正常";
            Entity.StuRoom.Add(room);

            Entity.SaveChanges();

            for (int i = 1; i <= room.SeatNum; i++)
            {
                Seat seatInfo = new Seat();
                seatInfo.RoomId = room.Id;
                seatInfo.SeatNo = i.ToString();
                seatInfo.State  = "空闲";
                Entity.Seat.Add(seatInfo);
            }

            Entity.SaveChanges();

            return(RedirectToAction("Manage"));
        }