Exemplo n.º 1
0
        public JsonResult Details(string Id)
        {
            QDTourAdminEntities db = new QDTourAdminEntities();

            var result = from guideReservation in db.Guide_Reservation
                         from member in guideReservation.Members
                         join guidePackage in db.Guide_Package on guideReservation.ID_Guide_Package equals guidePackage.Id
                         join guide in db.Guides on guideReservation.ID_Guide equals guide.Id
                         where guideReservation.Id == Id
                         select new
            {
                guideReservationId = guideReservation.Id,
                memberName         = member.Name,
                email          = member.Email,
                startTime      = guideReservation.Start_Time,
                endTime        = guideReservation.End_Time,
                numberOfPeople = guideReservation.People_Number,
                isPaid         = guideReservation.IsPaid,
                guideId        = guide.Id,
                Photo          = guidePackage.Photo,
                totalPrice     = guideReservation.TotalPrice,
                destination    = guidePackage.Destination
            };

            var aa = from guideReservation in db.Guide_Reservation
                     from member in guideReservation.Members
                     join guidePackage in db.Guide_Package on guideReservation.ID_Guide_Package equals guidePackage.Id
                     where guideReservation.Id == Id
                     select new
            {
                guideReservationId = guideReservation.Id,
                memberName         = member.Name,
                email          = member.Email,
                startTime      = guideReservation.Start_Time,
                endTime        = guideReservation.End_Time,
                numberOfPeople = guideReservation.People_Number,
                isPaid         = guideReservation.IsPaid,
                Photo          = guidePackage.Photo,
                totalPrice     = guideReservation.TotalPrice,
                destination    = guidePackage.Destination,
            };

            if (result.Count() == 0)
            {
                return(Json(aa, JsonRequestBehavior.AllowGet));
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }