예제 #1
0
        public List <RoomsDetailsView> GetRoomsSetting([FromBody] JObject dates)
        // public List<RoomsDetailsView> GetRoomsSetting()
        {//בחדר מספר 0 נמצאים כל הכלבים בהזמנות שלא שובצו
            // DateTime fromDate=new DateTime(DateTime.Now.Year,DateTime.Now.Month,DateTime.Now.Day).AddDays(2); DateTime toDate= new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day).AddDays(4);
            RoomsServie roomService = new RoomsServie();
            //DateTime fromDate = DateTime.Now;
            //DateTime toDate = DateTime.Now.AddDays(1);
            string json = JsonConvert.SerializeObject(dates);
            //DateTime fromDate = JObject.Parse(json)["@fromDate"];
            //var toDate = JObject.Parse(json)["@toDate"];
            var      data     = (JObject)JsonConvert.DeserializeObject(json);
            DateTime fromDate = data["fromDate"].Value <DateTime>();
            //var jArray = JArray.Parse(json);
            //DateTime fromDate = jArray[0]["fromDate"].Value<DateTime>();
            //  DateTime toDate = data["toDate"].Value<DateTime>();
            int fromShift = data["fromShift"].Value <int>();
            //  int toShift = data["toShift"].Value<int>();
            List <RoomsDetailsView> list             = roomService.GetRoomsSetting(fromDate, fromShift);
            RoomsDetailsView        roomsDetailsView = new RoomsDetailsView();

            roomsDetailsView.dogsInRoom   = roomService.GetDogsNoSetting(fromDate, fromShift);
            roomsDetailsView.RoomCapacity = 0;
            roomsDetailsView.RoomID       = 0;
            list.Insert(0, roomsDetailsView);
            return(list);
            //  List<RoomsDetailsView> rooms = roomService.GetRooms();
            //  return rooms;
        }