public JsonResult GetAvailableRooms(string text) { TreatmentRoom_Api roomApi = new TreatmentRoom_Api(); TreatmentRoomModel room = new TreatmentRoomModel(); room.date = DateTime.Parse(text); IEnumerable <string> availableRooms = roomApi.GetAvailableRooms(room).Select(r => r.room_ID); var ra = room.roomList; var displayRooms = new List <RoomValues>(); try { displayRooms = ra.Where(r => availableRooms.Contains(r.Value)).ToList(); } catch (Exception ex) { } return(Json(displayRooms, JsonRequestBehavior.AllowGet)); }