Пример #1
0
        public List <Hotel> GetHotelsByName(string Name)
        {
            List <Hotel> HotelsListByName = new List <Hotel>();

            using (dbcon = new TourismWebsiteDBEntities())
            {
                HotelsListByName = dbcon.Hotels.Where(x => (string)x.HotelName == Name).ToList();
            }

            return(HotelsListByName);
        }
 public ActionResult Signup(User model)
 {
     using (var context = new TourismWebsiteDBEntities())
     {
         context.Users.Add(model);
         context.SaveChanges();
     }
     ModelState.Clear();
     ViewBag.SuccessMethod = "Registration Successfull";
     return(RedirectToAction("Login"));
 }
Пример #3
0
        public List <TouristPlace> GetPlacesByName(string Name)
        {
            List <TouristPlace> PlacesListbyName = new List <TouristPlace>();

            using (dbcon = new TourismWebsiteDBEntities())
            {
                PlacesListbyName = dbcon.TouristPlaces.Where(x => (string)x.PlaceName == Name).ToList();
            }

            return(PlacesListbyName);
        }
Пример #4
0
        public Flight GetFlightName(int F_Id)
        {
            Flight F_Name = new Flight();

            using (dbcon = new TourismWebsiteDBEntities())
            {
                F_Name = (Flight)dbcon.Flights.Where(x => x.F_Id == F_Id).First();
            }

            return(F_Name);
        }
Пример #5
0
        public List <Flight> GetAllFlights()
        {
            List <Flight> Flightlist = new List <Flight>();

            using (dbcon = new TourismWebsiteDBEntities())
            {
                Flightlist = dbcon.Flights.ToList();
            }

            return(Flightlist);
        }
Пример #6
0
        public Hotel GetHotelPrice(int id)
        {
            Hotel HotelPrice = null;

            using (dbcon = new TourismWebsiteDBEntities())
            {
                HotelPrice = (Hotel)dbcon.Hotels.Where(x => x.Id == id).First();
            }

            return(HotelPrice);
        }
Пример #7
0
        public List <Hotel> GetHotelsByLocation(int Locationid)
        {
            List <Hotel> HotelList = new List <Hotel>();

            using (dbcon = new TourismWebsiteDBEntities())
            {
                HotelList = dbcon.Hotels.Where(x => (int)x.LocationId == Locationid).ToList();
            }

            return(HotelList);
        }
Пример #8
0
        public List <BlogSpace> GetBlogs(string title)
        {
            List <BlogSpace> BlogList = new List <BlogSpace>();

            using (dbcon = new TourismWebsiteDBEntities())
            {
                BlogList = dbcon.BlogSpaces.Where(x => x.Title == title).ToList();
            }

            return(BlogList);
        }
Пример #9
0
        /*        public List<double> GetCoordinates(string location)
         *      {
         *          List<double> coords = new List<double>();
         *          using (dbcon = new TourismWebsiteDBEntities())
         *          {
         *              var req = dbcon.Locations.Where(x => x.LocationName == location).FirstOrDefault();
         *              coords.Add(req.Latitude);
         *              coords.Add(req.Longitude);
         *
         *          }
         *          return coords;
         *      }
         *
         */
        public Location GetCoordinates(string location)
        {
            Location coords = new Location();

            using (dbcon = new TourismWebsiteDBEntities())
            {
                coords = dbcon.Locations.Where(x => x.LocationName == location).FirstOrDefault();
            }

            return(coords);
        }
Пример #10
0
        public List <TouristPlace> GetAllPlace()
        {
            List <TouristPlace> TPlaceList = new List <TouristPlace>();

            using (dbcon = new TourismWebsiteDBEntities())
            {
                TPlaceList = dbcon.TouristPlaces.ToList();
            }

            return(TPlaceList);
        }
Пример #11
0
        public List <User> GetAllUsers()
        {
            List <User> UserList = new List <User>();

            using (dbcon = new TourismWebsiteDBEntities())
            {
                UserList = dbcon.Users.ToList();
            }

            return(UserList);
        }
Пример #12
0
        public List <Hotel> GetAllHotel()
        {
            List <Hotel> Hotellist = new List <Hotel>();

            using (dbcon = new TourismWebsiteDBEntities())
            {
                Hotellist = dbcon.Hotels.ToList();
            }

            return(Hotellist);
        }
Пример #13
0
        public List <Location> GetAllLocations()
        {
            List <Location> LocList = new List <Location>();

            using (dbcon = new TourismWebsiteDBEntities())
            {
                LocList = dbcon.Locations.ToList();
            }

            return(LocList);
        }
Пример #14
0
        public List <BlogSpace> GetAllBlogs()
        {
            List <BlogSpace> Bloglist = new List <BlogSpace>();

            using (dbcon = new TourismWebsiteDBEntities())
            {
                Bloglist = dbcon.BlogSpaces.ToList();
            }

            return(Bloglist);
        }
Пример #15
0
        public Flight GetFlightName(string F_Name)
        {
            Flight flight = null;

            using (dbcon = new TourismWebsiteDBEntities())
            {
                flight = (Flight)dbcon.Flights.Where(x => x.F_Name == F_Name).First();
            }

            return(flight);
        }
Пример #16
0
        public List <Flight> GetFlightbyTime(string Departure_Time)
        {
            List <Flight> FlightList = new List <Flight>();

            using (dbcon = new TourismWebsiteDBEntities())
            {
                FlightList = dbcon.Flights.Where(x => x.Departure_Time == Departure_Time).ToList();
            }

            return(FlightList);
        }
Пример #17
0
        public List <TouristPlace> GetPlacesByRating(int Rating)
        {
            List <TouristPlace> PlacesByRating = new List <TouristPlace>();

            using (dbcon = new TourismWebsiteDBEntities())
            {
                PlacesByRating = dbcon.TouristPlaces.Where(x => x.Ratings == Rating).ToList();
            }

            return(PlacesByRating);
        }
Пример #18
0
        public List <TouristPlace> GetPlacesByLocation(int Locationid)
        {
            List <TouristPlace> PlacesListbyLocation = new List <TouristPlace>();

            using (dbcon = new TourismWebsiteDBEntities())
            {
                PlacesListbyLocation = dbcon.TouristPlaces.Where(x => (int)x.LocationId == Locationid).ToList();
            }

            return(PlacesListbyLocation);
        }
Пример #19
0
        public List <Flight> GetFlightsbyLocation(int LocationId)
        {
            List <Flight> FlightList = new List <Flight>();

            using (dbcon = new TourismWebsiteDBEntities())
            {
                FlightList = dbcon.Flights.Where(x => (int)x.LocationId == LocationId).ToList();
            }

            return(FlightList);
        }
Пример #20
0
        public Hotel GetHotel(int id)
        {
            Hotel hotel = new Hotel();

            using (dbcon = new TourismWebsiteDBEntities())
            {
                hotel = dbcon.Hotels.Find(id);
            }

            return(hotel);
        }
Пример #21
0
        public Hotel DeleteHotel(int id)
        {
            //bool status = false;
            Hotel hotel = new Hotel();

            using (dbcon = new TourismWebsiteDBEntities())
            {
                hotel = dbcon.Hotels.Find(id);
                dbcon.Hotels.Remove(hotel);
                int change = dbcon.SaveChanges();
            }
            return(hotel);
        }
Пример #22
0
        public bool InsertFlight(Flight obj)
        {
            bool status = false;

            using (dbcon = new TourismWebsiteDBEntities())
            {
                dbcon.Flights.Add(obj);
                int changes = dbcon.SaveChanges();
                if (changes > 0)
                {
                    status = true;
                }
            }
            return(status);
        }
Пример #23
0
        public bool DeleteBlog(int id)
        {
            bool status = false;

            using (dbcon = new TourismWebsiteDBEntities())
            {
                var Todel = dbcon.BlogSpaces.Find(id);
                dbcon.BlogSpaces.Remove(Todel);
                int change = dbcon.SaveChanges();
                if (change > 0)
                {
                    status = true;
                }
            }
            return(status);
        }
Пример #24
0
        public bool UpdateLocation(Location obj)
        {
            bool status = false;

            using (dbcon = new TourismWebsiteDBEntities())
            {
                dbcon.Locations.Add(obj);
                int changes = dbcon.SaveChanges();
                if (changes > 0)
                {
                    status = true;
                }
            }

            return(status);
        }
Пример #25
0
        public bool UpdateBlog(BlogSpace obj)
        {
            bool status = false;

            using (dbcon = new TourismWebsiteDBEntities())
            {
                dbcon.BlogSpaces.Add(obj);
                int changes = dbcon.SaveChanges();
                if (changes > 0)
                {
                    status = true;
                }
            }

            return(status);
        }
Пример #26
0
        public bool RatingAPlace(UserReview Review)
        {
            bool status = false;

            using (dbcon = new TourismWebsiteDBEntities())
            {
                dbcon.UserReviews.Add(Review);
                int changes = dbcon.SaveChanges();
                if (changes > 0)
                {
                    status = true;
                }
            }

            return(status);
        }
Пример #27
0
        public bool CreateUser(User obj)
        {
            bool status = false;

            using (dbcon = new TourismWebsiteDBEntities())
            {
                dbcon.Users.Add(obj);
                int changes = dbcon.SaveChanges();
                if (changes > 0)
                {
                    status = true;
                }
            }

            return(status);
        }
Пример #28
0
        public async Task <bool> InsertLocation(Location obj)
        {
            bool status = false;

            using (dbcon = new TourismWebsiteDBEntities())
            {
                dbcon.Locations.Add(obj);
                int changes = await dbcon.SaveChangesAsync();

                if (changes > 0)
                {
                    status = true;
                }
            }

            return(status);
        }
Пример #29
0
        public bool UpdateUser(User obj)
        {
            bool status = false;

            using (dbcon = new TourismWebsiteDBEntities())
            {
                var uobj = dbcon.Users.Where(x => x.UserId == obj.UserId).First();
                uobj.UserName      = obj.UserName;
                uobj.Isactive      = obj.Isactive;
                uobj.ContactNumber = obj.ContactNumber;
                int changes = dbcon.SaveChanges();
                if (changes > 0)
                {
                    status = true;
                }
            }
            return(status);
        }
Пример #30
0
        public bool UpdatePlace(TouristPlace obj)
        {
            bool status = false;

            using (dbcon = new TourismWebsiteDBEntities())
            {
                var uobj = dbcon.TouristPlaces.Where(x => x.Id == obj.Id).First();
                uobj.PlaceName = obj.PlaceName;
                uobj.Ratings   = obj.Ratings;

                int changes = dbcon.SaveChanges();
                if (changes > 0)
                {
                    status = true;
                }
            }
            return(status);
        }