public IEnumerable <ReservationsReportDTO> ReservationsReport(string user_id, string startDate, string endDate, string mode)
        {
            var list = new List <ReservationsReportDTO>();
            var res  = GetReservations(DateTime.Parse(startDate), DateTime.Parse(endDate), mode);

            foreach (Reservations r in res)
            {
                var record = new ReservationsReportDTO();

                record.Id        = r.Id;
                record.Date      = r.Date;
                record.UserId    = r.UserId;
                record.UserName  = r.User.FirstName.Trim() + " " + r.User.LastName.Trim();
                record.Nights    = r.ReservationDetails.Count();
                record.TotalRate = r.ReservationDetails.Sum(x => x.Rate);
                record.Status    = r.Active;

                list.Add(record);
            }

            return(list);
        }
        public IEnumerable <ReservationsReportDTO> UserReservations(string user_id, string requestor, string mode)
        {
            Users user = GetUser(user_id);
            Users req  = GetUser(requestor);

            var list = new List <ReservationsReportDTO>();
            var res  = GetUserReservations(user_id, mode);

            foreach (Reservations r in res)
            {
                var record = new ReservationsReportDTO();
                Console.WriteLine("------");


                record.Id        = r.Id;
                record.Date      = r.Date;
                record.UserId    = r.UserId;
                record.UserName  = r.User.FirstName.Trim() + " " + r.User.LastName.Trim();
                record.Nights    = r.ReservationDetails.Count();
                record.TotalRate = r.ReservationDetails.Sum(x => x.Rate);
                record.Status    = r.Active;
                if (r.ReservationDetails.Count > 0)
                {
                    record.StartDate = r.ReservationDetails.ElementAtOrDefault(0).Date;
                    record.EndDate   = r.ReservationDetails.ElementAtOrDefault(r.ReservationDetails.Count - 1).Date;
                }
                else
                {
                    record.StartDate = null;
                    record.EndDate   = null;
                }
                //record.StartDate = r.ReservationDetails.ElementAtOrDefault(0).Date;

                list.Add(record);
            }

            return(list);
        }