public async Task <OperationStatus> GetReservationBook(int id, long startTime, long endTime)
        {
            ReservationBook rBook = await _calendarRepository.SingleAsync <ReservationBook>(r => r.ID == id, "CalendarBookAllocations");

            TimePeriod timePeriod = new TimePeriod {
                unitsAsDays = true, startTime = startTime, endTime = endTime
            };
            ReservationBookDTO rBookDTO = new ReservationBookDTO(rBook, timePeriod, true, false, false);
            OperationStatus    ret;

            if (rBookDTO != null)
            {
                ret = new OperationStatus {
                    Status = true, Data = rBookDTO
                };
            }
            else
            {
                ret = new OperationStatus {
                    Status = false, Message = "Not found"
                };
            }

            return(ret);
        }
Example #2
0
        // GET: ReservationBookDTO/Details/1
        public ActionResult Details(int?id)
        {
            // IQueryable<ReservationBook> rBookQuery =
            //        from rbook in db.ReservationBooks
            //        select rbook;

            ReservationBookDTO rBookDTO = null;

            var rBookQuery =
                db.ReservationBooks
                .Include(r => r.CalendarBookAllocations)
                .Where(r => r.ID == (id + 1));

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            foreach (ReservationBook rBook in rBookQuery)
            {
                rBookDTO = new ReservationBookDTO(rBook, null, true, true, true);
            }

            if (rBookDTO == null)
            {
                return(HttpNotFound());
            }

            return(View(rBookDTO));
        }
        public async Task <OperationStatus> GetReservationBook(int id)
        {
            ReservationBook rBook = await _calendarRepository.SingleAsync <ReservationBook>(r => r.ID == id);

            ReservationBookDTO rBookDTO = new ReservationBookDTO(rBook, null, false, false, false);
            OperationStatus    ret;

            if (rBookDTO != null)
            {
                ret = new OperationStatus {
                    Status = true, Data = rBookDTO
                };
            }
            else
            {
                ret = new OperationStatus {
                    Status = false, Message = "Not found"
                };
            }

            return(ret);
        }