예제 #1
0
        public async Task <IActionResult> Create([Bind("Id,ImagePath,ImageText,Title,SubTitle,Duration,Code,Price,AboutTourText,AboutTourNumber,TourImage,TourName,TourInformation,TourVideo,TourCheckIn,TourText,TourTime,TourAdditional,TourSecondAdditional,Number,SecondNumber,Email,SiteAddress,Address,EventId")] BakuJara bakuJara, IFormFile ImagePath)
        {
            CustomDateTimeFile customDateTimeFile = new CustomDateTimeFile();
            string             fileName           = customDateTimeFile.GetFileName(ImagePath.FileName);

            if (ModelState.IsValid)
            {
                bakuJara.ImagePath = fileName;
                if (_IsAcceptedFormat(ImagePath.ContentType))
                {
                    string path = Path.Combine(hostingEnvironment.WebRootPath, "images", fileName);
                    byte[] data = new byte[ImagePath.Length];

                    using (FileStream fileStream = new FileStream(path, FileMode.Create))
                    {
                        await ImagePath.CopyToAsync(fileStream);
                    }
                }
                await _context.AddAsync(bakuJara);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EventId"] = new SelectList(_context.Events, "Id", "Id", bakuJara.EventId);
            return(View(bakuJara));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,TourImage,TourName,TourPrice,TourTime,TourAction,TourDuration")] MainPage mainPage, IFormFile TourImage)
        {
            CustomDateTimeFile customDateTimeFile = new CustomDateTimeFile();
            string             fileName           = customDateTimeFile.GetFileName(TourImage.FileName);

            if (ModelState.IsValid)
            {
                mainPage.TourImage = fileName;
                if (_IsAcceptedFormat(TourImage.ContentType))
                {
                    string path = Path.Combine(hostingEnvironment.WebRootPath, "images", fileName);
                    byte[] data = new byte[TourImage.Length];

                    using (FileStream fileStream = new FileStream(path, FileMode.Create))
                    {
                        await TourImage.CopyToAsync(fileStream);
                    }
                }
                await _context.AddAsync(mainPage);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(mainPage));
        }
예제 #3
0
        public async Task <IActionResult> Create([Bind("Id,ImagePath,ImageTitle,Title,Subtitle,Text,ServiceId")] Emergency emergency, IFormFile ImagePath)
        {
            CustomDateTimeFile customDateTimeFile = new CustomDateTimeFile();
            string             fileName           = customDateTimeFile.GetFileName(ImagePath.FileName);

            if (ModelState.IsValid)
            {
                emergency.ImagePath = fileName;
                if (_IsAcceptedFormat(ImagePath.ContentType))
                {
                    string path = Path.Combine(hostingEnvironment.WebRootPath, "images", fileName);
                    byte[] data = new byte[ImagePath.Length];

                    using (FileStream fileStream = new FileStream(path, FileMode.Create))
                    {
                        await ImagePath.CopyToAsync(fileStream);
                    }
                }
                await _context.AddAsync(emergency);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ServiceId"] = new SelectList(_context.Services, "Id", "Id", emergency.ServiceId);
            return(View(emergency));
        }
        public async Task <IActionResult> Create([Bind("Id,TourImage,TourIcon,TourName,TourTitle,TourTime,TourAction,ServiceId,Duration,TourId")] Incoming incoming, IFormFile TourImage)
        {
            //CustomDateTimeFile customDateTimeFile = new CustomDateTimeFile();
            //string fileName = customDateTimeFile.GetFileName(TourImage.FileName);

            if (ModelState.IsValid)
            {
                //incoming.TourImage = fileName;
                //if (_IsAcceptedFormat(TourImage.ContentType))
                //{

                //    string path = Path.Combine(hostingEnvironment.WebRootPath, "images", fileName);
                //    byte[] data = new byte[TourImage.Length];

                //    using (FileStream fileStream = new FileStream(path, FileMode.Create))
                //    {
                //        await TourImage.CopyToAsync(fileStream);
                //    }
                //}
                await _context.AddAsync(incoming);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ServiceId"] = new SelectList(_context.Services, "Id", "Id", incoming.ServiceId);
            ViewData["TourId"]    = new SelectList(_context.Tours, "Id", "ImagePath", incoming.TourId);
            return(View(incoming));
        }
예제 #5
0
        public async Task <IActionResult> Create([Bind("ImageTitle,Text,SubText,Id,ImagePath,Title,SubTitle")] About about, IFormFile ImagePath)
        {
            CustomDateTimeFile customDateTimeFile = new CustomDateTimeFile();
            string             fileName           = customDateTimeFile.GetFileName(ImagePath.FileName);

            if (ModelState.IsValid)
            {
                about.ImagePath = fileName;
                if (_IsAcceptedFormat(ImagePath.ContentType))
                {
                    string path = Path.Combine(hostingEnvironment.WebRootPath, "images", fileName);
                    byte[] data = new byte[ImagePath.Length];

                    using (FileStream fileStream = new FileStream(path, FileMode.Create))
                    {
                        await ImagePath.CopyToAsync(fileStream);
                    }
                }
                await _context.AddAsync(about);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(about));
        }
        public async Task <IActionResult> Create([Bind("Id,Price,ImagePath,ImageTitle,Title,SubTitle,Phone,OtherPhone,Email,SiteAddress,Address,ServiceId,TourId")] Transport transport, IFormFile ImagePath)
        {
            CustomDateTimeFile customDateTimeFile = new CustomDateTimeFile();
            string             fileName           = customDateTimeFile.GetFileName(ImagePath.FileName);

            if (ModelState.IsValid)
            {
                transport.ImagePath = fileName;
                if (_IsAcceptedFormat(ImagePath.ContentType))
                {
                    string path = Path.Combine(hostingEnvironment.WebRootPath, "images", fileName);
                    byte[] data = new byte[ImagePath.Length];

                    using (FileStream fileStream = new FileStream(path, FileMode.Create))
                    {
                        await ImagePath.CopyToAsync(fileStream);
                    }
                }
                await _context.AddAsync(transport);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ServiceId"] = new SelectList(_context.Services, "Id", "Id", transport.ServiceId);
            ViewData["TourId"]    = new SelectList(_context.Tours, "Id", "ImagePath", transport.TourId);
            return(View(transport));
        }
예제 #7
0
        public async Task <IActionResult> Create([Bind("Id,ImagePath,ImageTitle,Title,SubTitle,EventImage,EventIcon,EventName,EventTitle,EventTime,EventAction,Duration,ServiceId")] Event @event, IFormFile EventImage)
        {
            CustomDateTimeFile customDateTimeFile = new CustomDateTimeFile();
            string             fileName           = customDateTimeFile.GetFileName(EventImage.FileName);

            if (ModelState.IsValid)
            {
                @event.EventImage = fileName;
                if (_IsAcceptedFormat(EventImage.ContentType))
                {
                    string path = Path.Combine(hostingEnvironment.WebRootPath, "images", fileName);
                    byte[] data = new byte[EventImage.Length];

                    using (FileStream fileStream = new FileStream(path, FileMode.Create))
                    {
                        await EventImage.CopyToAsync(fileStream);
                    }
                }
                await _context.AddAsync(@event);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ServiceId"] = new SelectList(_context.Services, "Id", "Id", @event.ServiceId);
            return(View(@event));
        }
        public async Task <IActionResult> Create([Bind("Id,ImagePath,ImageText,Title,SubTitle,Duration,Code,Price,AboutTourText,AboutTourNumber,TourImage,TourName,TourInformation,TourVideo,TourCheckIn,TourText,TourTime,TourAdditional,TourAdditionalSecond,Number,SecondNumber,Email,SiteAddress,Address")] ShakiPage shakiPage, IFormFile TourImage)
        {
            CustomDateTimeFile customDateTimeFile = new CustomDateTimeFile();
            string             fileName           = customDateTimeFile.GetFileName(TourImage.FileName);

            if (ModelState.IsValid)
            {
                shakiPage.TourImage = fileName;
                if (_IsAcceptedFormat(TourImage.ContentType))
                {
                    string path = Path.Combine(hostingEnvironment.WebRootPath, "images", fileName);
                    byte[] data = new byte[TourImage.Length];

                    using (FileStream fileStream = new FileStream(path, FileMode.Create))
                    {
                        await TourImage.CopyToAsync(fileStream);
                    }
                }
                await _context.AddAsync(shakiPage);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(shakiPage));
        }
        public async Task <IActionResult> Create([Bind("Id,AboutHotel")] BilgehDescription bilgehDescription)
        {
            if (ModelState.IsValid)
            {
                _context.Add(bilgehDescription);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(bilgehDescription));
        }
        public async Task <IActionResult> Create([Bind("Id,Hotels")] NaftalanDescription naftalanDescription)
        {
            if (ModelState.IsValid)
            {
                _context.Add(naftalanDescription);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(naftalanDescription));
        }
        public async Task <IActionResult> Create([Bind("id,AboutTransport")] TransportDescription transportDescription)
        {
            if (ModelState.IsValid)
            {
                _context.Add(transportDescription);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(transportDescription));
        }
예제 #12
0
        public async Task <IActionResult> Create([Bind("Id,FirstSlide,FirstSlideText,SecondSlide,SecondSlideText,ThirdSlide,ThirdSlideText,FourthSlide,FourthSlideText,Title,SubTitle")] AzeTitleSubtitle azeTitleSubtitle)
        {
            if (ModelState.IsValid)
            {
                _context.Add(azeTitleSubtitle);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(azeTitleSubtitle));
        }
예제 #13
0
        public async Task <IActionResult> Create([Bind("Id,Name,Price,Description,TypeOf,Value")] BronHotel bronHotel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(bronHotel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(bronHotel));
        }
예제 #14
0
        public async Task <IActionResult> Create([Bind("Id,TourInclude")] GoyGolDescription goyGolDescription)
        {
            if (ModelState.IsValid)
            {
                _context.Add(goyGolDescription);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(goyGolDescription));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Surname,Email,Number,PassportNumber,Birth,Parent,Child,Baby,Message")] PersonalInformation personalInformation)
        {
            if (ModelState.IsValid)
            {
                _context.Add(personalInformation);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(personalInformation));
        }
예제 #16
0
        public async Task <IActionResult> Create([Bind("Id,Name,Surname,Age")] DemoStudent demoStudent)
        {
            if (ModelState.IsValid)
            {
                _context.Add(demoStudent);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(demoStudent));
        }
        public async Task <IActionResult> Create([Bind("Id,ImagePath,ImageTitle,AboutTourText,AboutTourNumber")] BronLankaran bronLankaran)
        {
            if (ModelState.IsValid)
            {
                _context.Add(bronLankaran);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(bronLankaran));
        }
        public async Task <IActionResult> Create([Bind("Id,AboutInsuarance")] InsuaranceDescription insuaranceDescription)
        {
            if (ModelState.IsValid)
            {
                _context.Add(insuaranceDescription);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(insuaranceDescription));
        }
예제 #19
0
        public async Task <IActionResult> Create([Bind("Id,Name,Surname,Email,Number,Message,Tour,DateTime")] SimpleInformation simpleInformation)
        {
            if (ModelState.IsValid)
            {
                _context.Add(simpleInformation);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(simpleInformation));
        }
예제 #20
0
        public async Task <IActionResult> Create([Bind("Id,Name,Surname,Email,Number,Messaging")] Message message)
        {
            if (ModelState.IsValid)
            {
                _context.Add(message);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(message));
        }
예제 #21
0
        public async Task <IActionResult> Create([Bind("Id,AboutTour")] QabalaDescriptions qabalaDescriptions)
        {
            if (ModelState.IsValid)
            {
                _context.Add(qabalaDescriptions);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(qabalaDescriptions));
        }
        public async Task <IActionResult> Create([Bind("Id,ImagePath,ImageText,Title,SubTitle,Name,Price,Description,ServiceId,UserId")] GroupTour groupTour)
        {
            if (ModelState.IsValid)
            {
                _context.Add(groupTour);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ServiceId"] = new SelectList(_context.Services, "Id", "Id", groupTour.ServiceId);
            return(View(groupTour));
        }
예제 #23
0
        public async Task <IActionResult> Event(Message mes)
        {
            if (ModelState.IsValid)
            {
                await _toursDbContext.AddAsync(mes);

                await _toursDbContext.SaveChangesAsync();
            }

            else
            {
                return(RedirectToAction("Error"));
            }
            return(Json(new { Result = "Success", Message = "Send Successfully" }));
        }
예제 #24
0
        public async Task <IActionResult> Naftalan(PersonalInformation bron)
        {
            List <ValidationResult> lists  = new List <ValidationResult>();
            ValidationContext       contet = new ValidationContext(bron);

            Validator.TryValidateObject(bron, contet, lists, true);
            var d = lists;

            if (ModelState.IsValid)
            {
                await _toursDbContext.AddAsync(bron);

                await _toursDbContext.SaveChangesAsync();
            }

            else
            {
                return(RedirectToAction("Error"));
            }
            return(Json(new { Result = "Success", Message = "Send Successfully" }));
        }
        public async Task<ActionResult> RemoveWishlist(IEnumerable<int> id)
        {
            if (!User.Identity.IsAuthenticated)
            {
                // User not authenticated
                // Response 401 Unauthenticated
                Response.StatusCode = 401;
                Response.End();
            }

            if (id == null || id.Count<int>() == 0)
            {
                // Argument not passed
                // Reponse 400 Bad Request
                Response.StatusCode = 400;
                Response.End();
            }

            var wishlists = db.WishList.ToList();
            var currentusername = User.Identity.Name;
            var userid = appdb.Users.Where(u => u.UserName == currentusername).FirstOrDefault().Id;
            var curruserwishitem = wishlists.Where(w => w.UserId == userid && w.TourId == id.First() && w.Expired == false).ToList();

            if (curruserwishitem.Count != 0)
            {
                db.WishList.Remove(curruserwishitem.FirstOrDefault());
                await db.SaveChangesAsync();
            }

            GlobalTours.wishlist = db.WishList.Where(w => w.UserId == userid && w.Expired == false).ToList();
            var wishlisttourids = GlobalTours.wishlist.Select(w => w.TourId).ToArray();
            var tours = GlobalTours.alltours.Where(t => wishlisttourids.Contains(t.Id)).ToList();
            ViewModelWishlist wishlist = new ViewModelWishlist() { wishlisttours = tours };
            return PartialView("MyWishlist", wishlist);
            //return Json(true);
        }