Пример #1
0
 public ActionResult Uploadblog(BlogSpace1 bg)
 {
     nd.BlogSpace1.Add(bg);
     nd.SaveChanges();
     ViewBag.message = "Blog details added successfully";
     return(View());
 }
 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 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);
        }
Пример #4
0
        public ActionResult Create([Bind(Include = "UserId,UserName,Password,City,EmailId,ContactNumber,Isactive,Isadmin")] User user)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(user);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(user));
        }
Пример #5
0
        public bool DeleteLocation(int id)
        {
            bool status = false;
            var  Todel  = dbcon.Locations.Find(id);

            dbcon.Locations.Remove(Todel);
            int change = dbcon.SaveChanges();

            if (change > 0)
            {
                status = true;
            }
            return(status);
        }
Пример #6
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);
        }
Пример #7
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);
        }
Пример #8
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);
        }
Пример #9
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);
        }
Пример #10
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);
        }
Пример #11
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);
        }
Пример #12
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);
        }
Пример #13
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);
        }
Пример #14
0
        public bool UpdateFlight(Flight obj)
        {
            bool status = false;

            using (dbcon = new TourismWebsiteDBEntities())
            {
                var flight = dbcon.Flights.Find(obj.F_Id);
                flight.F_Name         = obj.F_Name;
                flight.Start_From     = obj.Start_From;
                flight.Destination    = obj.Destination;
                flight.Departure_Date = obj.Departure_Date;
                flight.Departure_Time = obj.Departure_Time;
                int changes = dbcon.SaveChanges();
                if (changes > 0)
                {
                    status = true;
                }
            }
            return(status);
        }
Пример #15
0
        public bool UpdateHotel(Hotel obj)
        {
            bool status = false;

            using (dbcon = new TourismWebsiteDBEntities())
            {
                var getobj = dbcon.Hotels.Where(s => s.Id == obj.Id).First();
                if (obj.hotelImage != null)
                {
                    getobj.hotelImage = obj.hotelImage;
                }
                getobj.HotelName = obj.HotelName;
                getobj.Hoteltype = obj.Hoteltype;
                getobj.Price     = obj.Price;
                int changes = dbcon.SaveChanges();
                if (changes > 0)
                {
                    status = true;
                }
            }
            return(status);
        }