Exemplo n.º 1
0
        public ActionResult UpdateTour(FormCollection fc)
        {
            if (fc["Post_id"].Trim() != null && fc["Post_id"].Trim() != "0")
            {
                Models.Tour TourOld = new Tour().GetByTourID(Convert.ToInt32(fc["Post_id"].Trim()));
                TourOld.Tour_Name               = fc["Post_Tile"].Trim();
                TourOld.Tour_Content            = fc["editor"].Trim();
                TourOld.Tour_OrganizationalUnit = fc["Tour_OrganizationalUnit"].Trim();
                string Description = "";
                if (Funtions.StripHTML(fc["editor"].Trim()).Length > 200)
                {
                    Description = Funtions.StripHTML(fc["editor"].Trim());
                }
                else
                {
                    Description = Funtions.StripHTML(fc["editor"].Trim());
                }
                TourOld.Tour_Description   = Description;
                TourOld.Tour_Topic         = fc.ToString("tour_Topic");
                TourOld.Tour_Location      = fc.ToInt("Tour_Location");
                TourOld.Tour_Price         = fc.ToInt("Tour_Price");
                TourOld.Tour_DepartureDate = Funtions.ddMMyyyy(fc["Tour_DepartureDate"].Trim());
                TourOld.Tour_TimeZone      = Convert.ToInt32(fc["Tour_TimeZone"].Trim());
                TourOld.Tour_Itinerary     = fc["editor_Tour_Itinerary"].Trim();
                TourOld.Tour_Schedule      = fc["editor_Tour_Schedule"].Trim();
                TourOld.Tour_Rules         = fc["editor_Tour_Rules"].Trim();
                TourOld.Tour_ListImage     = fc["List_Images_Combo"].Trim();
                TourOld.Tour_Image         = fc["_thumbnail_id"].Trim();
                TourOld.Product_ID         = 1;
                TourOld.UserCreate         = Convert.ToInt32(Session["User_ID"]);
                TourOld.Tour_StarRate      = fc.ToDouble("Star_Rating");
                TourOld.Tour_Qty           = fc.ToInt("Tour_Qty");
                TourOld.Tour_Score         = fc.ToFloat("Tour_Score");
                TourOld.Tour_Price         = fc.ToInt("Tour_Price");
                TourOld.Tour_PriceSale     = fc.ToInt("Tour_PriceSale");
                TourOld.Hotel_ID           = fc.ToInt("Hotel_ID");
                TourOld.Update();

                TempData["MessagePost"] = "Cập nhật Combo thành công";
                return(RedirectToAction("EditTour", "Manager", new { id = TourOld.Tour_ID }));
            }
            else
            {
                Models.Tour TourOld = new Tour();
                TourOld.Tour_Name               = fc["Post_Tile"].Trim();
                TourOld.Tour_Content            = fc["editor"].Trim();
                TourOld.Tour_OrganizationalUnit = fc["Tour_OrganizationalUnit"].Trim();
                string Description = "";
                if (Funtions.StripHTML(fc["editor"].Trim()).Length > 200)
                {
                    Description = Funtions.StripHTML(fc["editor"].Trim());
                }
                else
                {
                    Description = Funtions.StripHTML(fc["editor"].Trim());
                }
                TourOld.Tour_Description = Description;
                TourOld.Tour_Topic       = fc.ToString("tour_Topic");
                TourOld.Tour_Location    = fc.ToInt("Tour_Location");
                TourOld.Hotel_ID         = fc.ToInt("Hotel_ID");

                TourOld.Tour_DepartureDate = Funtions.ddMMyyyy(fc["Tour_DepartureDate"].Trim());
                TourOld.Tour_TimeZone      = fc.ToInt("Tour_TimeZone");
                TourOld.Tour_Itinerary     = fc["editor_Tour_Itinerary"].Trim();
                TourOld.Tour_Schedule      = fc["editor_Tour_Schedule"].Trim();
                TourOld.Tour_Rules         = fc["editor_Tour_Rules"].Trim();
                TourOld.Tour_ListImage     = fc["List_Images_Combo"].Trim();
                TourOld.Tour_Image         = fc["_thumbnail_id"].Trim();
                TourOld.Product_ID         = 1;
                TourOld.UserCreate         = Convert.ToInt32(Session["User_ID"]);
                TourOld.CreateDate         = DateTime.Now;
                TourOld.Tour_StarRate      = fc.ToDouble("Star_Rating");
                TourOld.Tour_Qty           = fc.ToInt("Tour_Qty");
                TourOld.Tour_Score         = fc.ToFloat("Tour_Score");
                TourOld.Tour_Price         = fc.ToInt("Tour_Price");
                TourOld.Tour_PriceSale     = fc.ToInt("Tour_PriceSale");
                int TourID = TourOld.Insert();

                TempData["MessagePost"] = "Thêm mới Combo thành công";
                return(RedirectToAction("EditTour", "Manager", new { id = TourID }));
            }
        }