Exemplo n.º 1
0
        public static List <CassandraRoom> ToCassandraRoom(this RowSet rows)
        {
            List <CassandraRoom> result = new List <CassandraRoom>();
            string whichQuery           = rows.Columns.First().Table;

            foreach (var row in rows)
            {
                float cost = whichQuery.Equals("toclean") ? float.NaN : row.GetValue <float>("cost");

                string guestFullName = whichQuery.Equals("byhotel") ? row.GetValue <string>("guestfullname") : String.Empty;
                int    guestId       = whichQuery.Equals("byhotel") ? row.GetValue <int>("guestid") : 0;

                CassandraRoom cr = new CassandraRoom()
                {
                    Hotel         = row.GetValue <string>("hotel"),
                    Floor         = row.GetValue <int>("floor"),
                    RoomNumber    = row.GetValue <int>("roomnumber"),
                    Cost          = cost,
                    GuestFullName = guestFullName,
                    GuestId       = guestId,
                    HotelId       = row.GetValue <int>("hotelid"),
                    RoomId        = row.GetValue <int>("roomid")
                };
                result.Add(cr);
            }
            return(result);
        }
Exemplo n.º 2
0
        public ActionResult <CassandraRoom> GetUnoccupiedCheapest([FromBody] Hotel hotel)
        {
            CassandraRoom result = RoomQuery.ToOccupyCheapest(hotel);

            return(result);
        }