protected void ButtonSearch_Click(object sender, EventArgs e) { try { string hotelName = TextBoxHotelName.Text; string CheckInTime = TextBoxNgayDen.Text; string CheckOutTime = TextBoxNgayDi.Text; SearchInput input = new SearchInput { KeyWord = hotelName, DateCheckIn = DateTime.Parse(CheckInTime, CultureInfo.GetCultureInfo("en-Gb")), DateCheckOut = DateTime.Parse(CheckOutTime, CultureInfo.GetCultureInfo("en-Gb")), CityId = int.Parse(ddlCity.SelectedValue), Star = int.Parse(ddlStar.SelectedValue) }; DatPhongKhachSanDbContext db = new DatPhongKhachSanDbContext(); db.SearchInputs.Add(input); db.SaveChanges(); Response.Redirect("/tim-kiem?sId=" + input.Id); } catch { } }
public string GetAutoSuggest(string name) { DatPhongKhachSanDbContext db = new DatPhongKhachSanDbContext(); return string.Join(",", db.Hotels.Where(x => x.Name.Contains(name)).ToList())+"a,a,a,a,a"; }