public IHttpActionResult GetNumberOfRooms()
        {
            var roomList      = db.Rooms.ToList().Select(x => ViewModelMapper.ToViewModelRooms(x)).ToList();
            var numberOfRooms = roomList.Count;

            return(Ok(numberOfRooms));
        }
        public IHttpActionResult GetRoom(int id)
        {
            Room room = db.Rooms.Find(id);

            if (room == null)
            {
                return(NotFound());
            }

            return(Ok(ViewModelMapper.ToViewModelRooms(room)));
        }
        public IHttpActionResult PostRoom(RoomViewModel roomViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            Room room = ViewModelMapper.ToModelRooms(roomViewModel);

            db.Rooms.Add(room);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = room.RoomId }, ViewModelMapper.ToViewModelRooms(room)));
        }
        public IHttpActionResult DeleteRoom(int id)
        {
            Room room = db.Rooms.Find(id);

            if (room == null)
            {
                return(NotFound());
            }

            db.Rooms.Remove(room);
            db.SaveChanges();

            return(Ok(ViewModelMapper.ToViewModelRooms(room)));
        }
 // GET: api/RoomsApi
 public List <RoomViewModel> GetRooms()
 {
     return(db.Rooms.ToList().Select(x => ViewModelMapper.ToViewModelRooms(x)).ToList());
 }