public bool Add(iPow.Infrastructure.Data.DataSys.Sys_SearchInfo enitty, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser) { var res = false; if (enitty != null) { try { searchInfoRepository.Add(enitty); searchInfoRepository.Uow.Commit(); res = true; } catch (Exception ex) { } } return(res); }
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)); }