public ViewResult Index(FormCollection f) { SearchInfoDto data = new SearchInfoDto(); if (f["txtDays"] != null) { //字符串表现形式转换为等同它的32位有效字符 data.Days = int.Parse(f["txtDays"].ToString()); } if (f["txtMoney"] != null) { data.Money = int.Parse(f["txtMoney"].ToString()); } if (f["txtSearch"] != null) { data.Bide = f["txtSearch"].ToString(); } if (f["RadioGroup1"] != null) { data.Type = f["RadioGroup1"].ToString(); } int total = 0; IQueryable<SearchTourDto> iq = searchService.GetSearchTourModel(data, 1, pageSize, ref total); PagedList<SearchTourDto> model = new PagedList<SearchTourDto>(iq, 1, pageSize, total); data.Bide = Server.UrlEncode(data.Bide); ViewBag.para = data; #region add var searchInfo = new Sys_SearchInfo(); searchInfo.Ip = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP(); if (searchInfo.Ip.Equals("::1")) { searchInfo.Ip = "127.0.0.1"; } searchInfo.KeyWord = Server.UrlDecode(data.Bide); //searchInfo.SearchID = searchInfoReopsitory.GetList().Max(d=> d.); searchInfo.AddTime = System.DateTime.Now; searchInfo.City = String.Empty; try { searchInfoReopsitory.Add(searchInfo); searchInfoReopsitory.Uow.Commit(); } catch (Exception ex) { string massage = ex.Message; } #endregion return View(model); }
/// <summary> /// 创建新的 Sys_SearchInfo 对象。 /// </summary> /// <param name="searchID">SearchID 属性的初始值。</param> public static Sys_SearchInfo CreateSys_SearchInfo(global::System.Int32 searchID) { Sys_SearchInfo sys_SearchInfo = new Sys_SearchInfo(); sys_SearchInfo.SearchID = searchID; return sys_SearchInfo; }
/// <summary> /// 用于向 Sys_SearchInfo EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet<T> 属性的 .Add 方法。 /// </summary> public void AddToSys_SearchInfo(Sys_SearchInfo sys_SearchInfo) { base.AddObject("Sys_SearchInfo", sys_SearchInfo); }