/// <summary> /// GetUserDIYByID /// </summary> /// <param name="planID"></param> /// <returns></returns> public Miaow.Infrastructure.Data.DataSys.Sys_TourPlan GetTourPlanByID(int planID) { var data = new Miaow.Infrastructure.Data.DataSys.Sys_TourPlan(); data = tourPlanRepository.GetList(e => e.PlanID == planID).First(); return data; }
public ViewResult CreatePlan(Miaow.Domain.Dto.Sys_TourPlanDto tour) { try { if (!ModelState.IsValid) { return View(tour); } else { var data = new Miaow.Infrastructure.Data.DataSys.Sys_TourPlan(); data.AddTime = System.DateTime.Now; data.Days = tour.Days; data.Destination = tour.Destination; data.IsDelete = 0; data.IsTop = 0; data.PlanClass = tour.PlanClass; data.PlanTitle = tour.PlanTitle; data.Remark = tour.Remark; data.TempDataCreateHtml = tour.TempDataCreateHtml; data.TopReason = ""; data.TopTime = null; data.UserId = tour.UserId; data.UserName = tour.UserName; data.VisitCount = 0; tourPlanRepository.Add(data); tourPlanRepository.Uow.Commit(); } return View(new GridModel(this.CurrentUserTourPlan())); } catch { return View(tour); } }
/// <summary> /// 根据City Create User DIY Tour /// </summary> /// <param name="tour"></param> public Miaow.Infrastructure.Data.DataSys.Sys_TourPlan AddTourPlan(Miaow.Infrastructure.Data.DataSys.Sys_TourPlan tour) { var data = new Miaow.Infrastructure.Data.DataSys.Sys_TourPlan(); data.AddTime = tour.AddTime; data.Days = tour.Days; data.Destination = tour.Destination; data.IsDelete = 0; data.IsTop = 0; data.PlanClass = null; data.PlanTitle = tour.PlanTitle; data.Remark = tour.PlanTitle; data.TempDataCreateHtml = null; data.TopReason = ""; data.TopTime = null; data.UserId = tour.UserId; data.UserName = tour.UserName; data.VisitCount = 0; try { tourPlanRepository.Add(data); tourPlanRepository.Uow.Commit(); } catch (Exception) { throw new ArgumentException("添加失败!"); } Miaow.Infrastructure.Data.DataSys.Sys_TourPlan res = tourPlanRepository.GetList(e => e.PlanTitle == tour.PlanTitle).First(); return res; }