Example #1
0
        public ActionResult Edit(FormCollection tour)
        {
            var    tp        = new Sys_TourPlan();
            var    tt        = new Infrastructure.Data.DataSys.Sys_TourPlan();
            string AddTime   = string.Empty;
            string Days      = string.Empty;
            string PlanTitle = string.Empty;
            string City      = string.Empty;
            string id        = string.Empty;

            if (tour != null)
            {
                #region 赋值一
                if (tour["AddTime"] != null)
                {
                    tt.AddTime = Convert.ToDateTime(tour["AddTime"]);
                }
                if (tour["Days"] != null)
                {
                    tt.Days = Convert.ToInt32(tour["Days"]);
                }
                if (tour["City"] != null)
                {
                    tt.Destination = tour["City"].ToString();
                }
                if (tour["PlanTitle"] != null)
                {
                    tt.PlanTitle = tour["PlanTitle"].ToString();
                    tt.Remark    = tour["PlanTitle"].ToString();
                }
                if (tour["id"] != null)
                {
                    tt.PlanID = Convert.ToInt32(tour["id"]);
                }
                tt.IsDelete  = 0;
                tt.IsTop     = 0;
                tt.TopReason = "";

                #endregion

                var model = tourPlanService.GetTourPlanByID(tt.PlanID);

                #region 赋值二
                model.PlanID             = tt.PlanID;
                model.AddTime            = tt.AddTime;
                model.Days               = tt.Days;
                model.Destination        = tt.Destination;
                model.IsDelete           = 0;
                model.IsTop              = 0;
                model.PlanClass          = null;
                model.PlanTitle          = tt.PlanTitle;
                model.Remark             = tt.PlanTitle;
                model.TempDataCreateHtml = null;
                model.TopReason          = "";
                model.TopTime            = null;
                model.UserId             = 1;      //这里  默认为1
                model.UserName           = "******"; //测试研发阶段
                model.VisitCount         = 0;
                #endregion

                tp = tourPlanService.UpdateTourPlan(model);
            }
            return(RedirectToAction("plan", new { id = 1, PlanID = tp.PlanID }));
        }