예제 #1
0
        public ActionResult CreateRoom(Room room)
        {           
            var dbRoom = db.room.
            if (TryValidateModel(room)) {
                db.Rooms.Add(room);
                db.SaveChanges();
                return Redirect("Index");
            }

            return View();
        }
예제 #2
0
        public ActionResult UpdateRoom(Room room)
        {
            db.rooms.Attach(room);
            var entry = db.Entry(room);
            entry.State = System.Data.Entity.EntityState.Modified;

            TryUpdateModel<Room>(room);
         
                db.SaveChanges();

            return View();
        }