public ActionResult Create([Bind(Include = "ID,Text1,Text2,Text3,Text4,SlideImg")] Slide slide, HttpPostedFileBase SlideImg)
        {
            if (ModelState.IsValid)
            {
                if (SlideImg == null)
                {
                    return(RedirectToAction("Create", "HomeSlides"));
                }
                if (Extension.CheckImg(SlideImg, Extension.MAxfileSize))
                {
                    try
                    {
                        slide.SlideImg = Extension.SaveImg(SlideImg, "~/Public/images/slider");
                    }
                    catch
                    {
                        return(View(slide));
                    }
                }
                else
                {
                    return(View(slide));
                }
                db.Slides.Add(slide);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(slide));
        }
        public ActionResult Create([Bind(Include = "Id,Text1,Text2,Image")] HomeSlide homeSlide, HttpPostedFileBase Image)
        {
            if (ModelState.IsValid)
            {
                if (Image == null)
                {
                    return(RedirectToAction("Create", "HomeSlides"));
                }
                if (Extension.CheckImg(Image, Extension.MAxfileSize))
                {
                    try
                    {
                        homeSlide.Image = Extension.SaveImg(Image, "~/Public2/images/home");
                    }
                    catch
                    {
                        return(View(homeSlide));
                    }
                }
                else
                {
                    return(View(homeSlide));
                }
                db.HomeSlides.Add(homeSlide);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(homeSlide));
        }
Example #3
0
        public ActionResult Create([Bind(Include = "Id,Images,Car")] Transfer transfer, HttpPostedFileBase Images)
        {
            if (ModelState.IsValid)
            {
                if (Images == null)
                {
                    return(RedirectToAction("Create", "ServicesHeaders"));
                }
                if (Extension.CheckImg(Images, Extension.MAxfileSize))
                {
                    try
                    {
                        transfer.Images = Extension.SaveImg(Images, "~/Public2/images/service");
                    }
                    catch
                    {
                        return(View(transfer));
                    }
                }
                else
                {
                    return(View(transfer));
                }
                db.Transfers.Add(transfer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(transfer));
        }
Example #4
0
        public ActionResult Create([Bind(Include = "Id,Image,Fullname,Job,Email,SocialID")] OurTeam ourTeam, HttpPostedFileBase Image)
        {
            if (ModelState.IsValid)
            {
                if (Image == null)
                {
                    return(RedirectToAction("Create", "OurTeams"));
                }
                if (Extension.CheckImg(Image, Extension.MAxfileSize))
                {
                    try
                    {
                        ourTeam.Image = Extension.SaveImg(Image, "~/Public2/images/team");
                    }
                    catch
                    {
                        return(View(ourTeam));
                    }
                }
                else
                {
                    return(View(ourTeam));
                }
                db.OurTeams.Add(ourTeam);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.SocialID = new SelectList(db.Socials, "Id", "Link1", ourTeam.SocialID);
            return(View(ourTeam));
        }
Example #5
0
        public ActionResult Create([Bind(Include = "Id,Header,TextH,TextP")] AboutU aboutU, HttpPostedFileBase Image)
        {
            if (ModelState.IsValid)
            {
                if (Image == null)
                {
                    return(RedirectToAction("Create", "AboutUs"));
                }
                if (Extension.CheckImg(Image, Extension.MAxfileSize))
                {
                    try
                    {
                        aboutU.Image = Extension.SaveImg(Image, "~/Public2/images/about");
                    }
                    catch
                    {
                        return(View(aboutU));
                    }
                }
                else
                {
                    return(View(aboutU));
                }
                db.AboutUS.Add(aboutU);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(aboutU));
        }
Example #6
0
        public ActionResult Create([Bind(Include = "ID,SortBy")] TourSort tourSort)
        {
            if (ModelState.IsValid)
            {
                db.TourSorts.Add(tourSort);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tourSort));
        }
        public ActionResult Create([Bind(Include = "ID,Hotel1")] Hotel hotel)
        {
            if (ModelState.IsValid)
            {
                db.Hotels.Add(hotel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(hotel));
        }
        public ActionResult Create([Bind(Include = "ID,Location,Duration,Min_Age,Max_People,Landing,Check_In,Check_Out")] Additional_Info additional_Info)
        {
            if (ModelState.IsValid)
            {
                db.Additional_Info.Add(additional_Info);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(additional_Info));
        }
Example #9
0
        public ActionResult Create([Bind(Include = "ID,Ticket1")] Ticket ticket)
        {
            if (ModelState.IsValid)
            {
                db.Tickets.Add(ticket);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(ticket));
        }
        public ActionResult Create([Bind(Include = "ID,Location,Phone,Email,Address,Office")] Contact contact)
        {
            if (ModelState.IsValid)
            {
                db.Contacts.Add(contact);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(contact));
        }
Example #11
0
        public ActionResult Create([Bind(Include = "Id,Names,ServiceID")] Service service)
        {
            if (ModelState.IsValid)
            {
                db.Services.Add(service);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ServiceID = new SelectList(db.ServicesHeaders, "Id", "Image", service.ServiceID);
            return(View(service));
        }
Example #12
0
        public ActionResult Create([Bind(Include = "ID,TourName,TourDay,HotelStar,Price,Image,Description,Additional_Info_ID,Map_Tour,TourSortID")] TourPacket tourPacket)
        {
            if (ModelState.IsValid)
            {
                db.TourPackets.Add(tourPacket);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Additional_Info_ID = new SelectList(db.Additional_Info, "ID", "Location", tourPacket.Additional_Info_ID);
            ViewBag.TourSortID         = new SelectList(db.TourSorts, "ID", "SortBy", tourPacket.TourSortID);
            return(View(tourPacket));
        }