public ActionResult ScheduleEdit(int productScheduleId)
        {
            var productSchedule = _productScheduleService.GetProductScheduleById(productScheduleId);
            ProductScheduleFormModel productScheduleFormModel = Mapper.Map <ProductSchedule, ProductScheduleFormModel>(productSchedule);

            productScheduleFormModel.Price       = productSchedule.Price;
            productScheduleFormModel.MaxQuantity = productSchedule.MaxQuantity;
            productScheduleFormModel.IsAvailable = productSchedule.IsAvailable;
            productScheduleFormModel.ListProduct = _productService.GetProducts().Where(p => p.ProductCategory.Name.Contains("Tour")).ToSelectListItems(-1);
            return(View(model: productScheduleFormModel));
        }
 public ActionResult KhachSan(String slug, String id, int page = 0, int totalPage = 0, String viewType = "list")
 {
     SetDefaultAttribute();
     ViewBag.tour = "DEAL KHÁCH SẠN";
     if (slug == "" || slug == null || slug == "/")
     {
         var model = new TourTrongNuocModel();
         model.tourType = "";
         model.viewType = viewType;
         if (totalPage == 0)
         {
             totalPage = _productService.GetHotel().ToList().Count;
             if (totalPage % item_per_page == 0)
             {
                 model.totalPage = totalPage / item_per_page;
             }
             else
             {
                 model.totalPage = totalPage / item_per_page + 1;
             }
         }
         else
         {
             model.totalPage = totalPage;
         }
         model.listTourInHot = _productService.GetHotelPopulaire().ToList();
         if (page > 0)
         {
             model.listTourIn = _productService.GetHotel().Skip((page - 1) * item_per_page).Take(item_per_page).ToList();
             return(PartialView("KhachSanPartial", model));
         }
         else
         {
             model.listTourIn = _productService.GetHotel().Take(item_per_page).ToList();
             return(View("KhachSan", model));
         }
     }
     else
     {
         if (id == "" || id == null || id == "/")
         {
             var model           = new List <Product>();
             var current_product = _productService.GetProductBySlug(slug);
             if (current_product != null && !current_product.IsDeleted)
             {
                 var list_product_similar = _productService.GetSimilarProduct(current_product).ToList();
                 model.Add(current_product);
                 if (list_product_similar != null)
                 {
                     foreach (var item in list_product_similar)
                     {
                         if (item.Id != current_product.Id)
                         {
                             model.Add(item);
                         }
                     }
                 }
                 return(View("KhachSanChiTiet", model));
             }
         }
         else
         {
             var model = new List <ProductSchedule>();
             var current_product_schedule = _productScheduleService.GetProductScheduleById(Int32.Parse(id));
             if (current_product_schedule != null && current_product_schedule.IsAvailable && !current_product_schedule.IsDeleted)
             {
                 var list_product_schedule_similar = _productScheduleService.GetSimilarProductSchedule(current_product_schedule).ToList();
                 model.Add(current_product_schedule);
                 if (list_product_schedule_similar != null)
                 {
                     foreach (var item in list_product_schedule_similar)
                     {
                         if (item.Id != current_product_schedule.Id)
                         {
                             model.Add(item);
                         }
                     }
                 }
                 return(View("PhongChiTiet", model));
             }
         }
         return(View("Error"));
     }
 }