public ActionResult Details(int?id)
        {
            var tour = _tourRepository.GetById((int)id);

            if (tour == null)
            {
                return(HttpNotFound());
            }
            //get destiantions in tour
            var    destinations = _destinatioRepository.GetDestinationByidTour((int)id);
            string dess         = "";

            foreach (var item in destinations)
            {
                dess += item.Name + " - ";
            }
            ViewBag.Destination = dess.Substring(0, dess.Length - 3);

            string[] listImages = tour.Image.Split('-');
            ViewBag.ListImages = listImages;

            //get remain quantity in tour
            var remainingQuantity = _tourRepository.GetRemainingQuantity((int)id);

            ViewBag.Remaining = remainingQuantity;


            return(View(tour));
        }
        public ActionResult CheckTour()
        {
            //finf tours on 3 next day
            var         tours          = _tourRepository.SearchByDate(DateTime.Now);
            List <Tour> listTourCancel = new List <Tour>();

            foreach (var item in tours)
            {
                int a = _tourRepository.GetRemainingQuantity(item.Id);
                if (a > 10)
                {
                    listTourCancel.Add(item);
                }
            }

            return(View(listTourCancel));
        }
Example #3
0
        public ActionResult OrderTour(int id)
        {
            var tour = _tourRepository.GetById(id);

            ViewBag.Tour = tour;
            string[] listImages = tour.Image.Split('-');
            ViewBag.ListImages = listImages;

            var remainingQuantity = _tourRepository.GetRemainingQuantity((int)id);

            ViewBag.Remaining = remainingQuantity;

            if (Session["username"] == null)
            {
                return(RedirectToAction("Login", "Users"));
            }
            else
            {
                return(View());
            }
        }