Esempio n. 1
0
 public ActionResult AboutUsReadMore()
 {
     using (var db = new PrimeTravelEntities())
     {
         var aboutUs = db.AboutUs.FirstOrDefault();
         return(View(aboutUs));
     }
 }
Esempio n. 2
0
 public static string GetUsername(string id)
 {
     using (var db = new PrimeTravelEntities())
     {
         var userId   = Convert.ToInt64(id);
         var username = (from u in db.User
                         where u.UserId == userId
                         select u.Username).FirstOrDefault();
         return(username);
     }
 }
Esempio n. 3
0
 public ActionResult ServicesInfo(int Id)
 {
     using (var db = new PrimeTravelEntities())
     {
         var service = (from data in db.Service
                        where data.ServiceId == Id
                        select new ServiceModel()
         {
             ServiceType = data.ServiceType,
             ServiceViewMore = (from i in db.ServiceViewMore
                                where i.ServiceId == data.ServiceId
                                select new ServiceViewMoreModel()
             {
                 ServiceViewMoreId = i.ServiceViewMoreId,
                 SVMImage = i.ServiceImage
             }).FirstOrDefault()
         }).SingleOrDefault();
         return(View(service));
     }
 }
Esempio n. 4
0
 public JsonResult GetGalleryFromLocation(long id)
 {
     using (var db = new PrimeTravelEntities())
     {
         if (id == 0)
         {
             return(Json(new { result = "failed", message = "Location not found." }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             var galleries    = db.ExperienceDetail.Where(e => e.LocationId == id).ToList();
             var locationName = db.Experience.Where(e => e.LocationId == id).Select(e => e.LocationName).FirstOrDefault();
             if (galleries.Count == 0)
             {
                 return(Json(new { result = "failed", message = "This location has no gallery.", location = locationName }, JsonRequestBehavior.AllowGet));
             }
             else
             {
                 return(Json(new { result = "success", galleries = galleries, LocationName = locationName }, JsonRequestBehavior.AllowGet));
             }
         }
     }
 }
Esempio n. 5
0
 public ActionResult Index()
 {
     using (var db = new PrimeTravelEntities())
     {
         var banner = (from data in db.Banner
                       where !data.IsDeleted && data.IsActive
                       select new BannerModel()
         {
             BannerDescription = data.BannerDescription,
             BImage = data.BannerImage,
         }).ToList();
         var primeConfiguration = db.PrimeConfiguration.ToList();
         var services           = (from data in db.Service
                                   where data.IsDeleted == false
                                   select new ServiceModel()
         {
             ServiceId = data.ServiceId,
             ServiceType = data.ServiceType,
             ServiceInfos = (from i in db.ServiceInfo
                             where i.ServiceId == data.ServiceId && !i.IsDeleted
                             select new ServiceInfoModel()
             {
                 SImage = i.ServiceImage,
                 ServiceName = i.ServiceName,
             }).ToList(),
             ServiceViewMore = (from i in db.ServiceViewMore
                                where i.ServiceId == data.ServiceId
                                select new ServiceViewMoreModel()
             {
                 ServiceViewMoreId = i.ServiceViewMoreId,
                 SVMImage = i.ServiceImage
             }).FirstOrDefault()
         }).ToList();
         var aboutUs = db.AboutUs.Select(e => new AboutUsViewModel
         {
             AboutUsTitle             = e.AboutUsTitle,
             AboutUsTopDescription    = e.AboutUsTopDescription,
             AboutUsBottomDescription = e.AboutUsBottomDescription,
             AboutUsImageUrl          = e.AboutUsImage,
         }).FirstOrDefault();
         var experience = db.Experience.Select(e => new ExperienceViewModel()
         {
             LocationId   = e.LocationId,
             LocationName = e.LocationName,
             CountryName  = e.CountryName,
             Latitude     = e.Latitude,
             Longitude    = e.Longitude
         }).ToList();
         var contact = db.Contact.Select(e => new ContactUsViewModel()
         {
             ContactTitle     = e.ContactTitle,
             ContactName      = e.ContactName,
             ContactAddress   = e.ContactAddress,
             ContactLatitude  = e.ContactLatitude,
             ContactLongitude = e.ContactLongitude,
             ContactDetails   = db.ContactDetail.Select(f => new ContactDetailViewModel()
             {
                 ReservationTitle = f.ReservationTitle,
                 ContactNumber    = f.ContactNumber,
             }).ToList(),
             ContactEmails = db.ContactEmail.Select(a => new ContactEmailViewModel()
             {
                 ContactEmailAddress = a.ContactEmailAddress,
             }).ToList(),
         }).FirstOrDefault();
         return(View(new HomeModel()
         {
             Banners = banner,
             ServiceTitle = primeConfiguration.Where(e => e.ConfigurationName == "ServiceTitle").Select(e => e.ConfigurationValue).FirstOrDefault(),
             ServiceSubTitle = primeConfiguration.Where(e => e.ConfigurationName == "ServiceSubTitle").Select(e => e.ConfigurationValue).FirstOrDefault(),
             ExperienceTitle = primeConfiguration.Where(e => e.ConfigurationName == "ExperienceTitle").Select(e => e.ConfigurationValue).FirstOrDefault(),
             Services = services,
             AboutUs = aboutUs,
             Experiences = experience,
             ContactUs = contact,
         }));
     }
 }