public async Task <IHttpActionResult> SearchSelection([FromBody] SearchSelectionInput json) { try { if (json.SelectionId == "provinces") // استان { var provinceList = await _provinceService.SearchProvinceAsync(json.SearchText, json.Limit); var buttonSimpleList = new List <ButtonSimpleModel>(); foreach (var province in provinceList) { buttonSimpleList.Add(new ButtonSimpleModel { Type = ButtonSimpleTypeEnum.TextOnly, Text = province.Title, ImageUrl = null }); } return(Ok(new { items = buttonSimpleList })); } if (json.SelectionId == "axes") { var list = await _festivalService.SearchFestivalAxesListAsync(json.SearchText.PersianToEnglish(), json.Limit); //var list = await _candidateService.SearchCandidateAsync(userInfo.StateName, json.SearchText, json.Limit); var buttonSimpleList = new List <ButtonSimpleModel>(); foreach (var item in list) { buttonSimpleList.Add(new ButtonSimpleModel { Type = ButtonSimpleTypeEnum.TextOnly, Text = $"{item.Title}", ImageUrl = null }); } return(Ok(new { items = buttonSimpleList })); } if (json.SelectionId == "fields") { var info = await _groupService.GetGroupInfo(json.ChatId); var list = await _festivalService.SearchFestivalFieldsListAsync(info.FestivalAxId.Value, json.SearchText.PersianToEnglish(), json.Limit); //var list = await _candidateService.SearchCandidateAsync(userInfo.StateName, json.SearchText, json.Limit); var buttonSimpleList = new List <ButtonSimpleModel>(); foreach (var item in list) { buttonSimpleList.Add(new ButtonSimpleModel { Type = ButtonSimpleTypeEnum.TextOnly, Text = $"{item.Title}", ImageUrl = null }); } return(Ok(new { items = buttonSimpleList })); } if (json.SelectionId == "majors") { var info = await _groupService.GetGroupInfo(json.ChatId); var list = await _festivalService.SearchFestivalMajorsListAsync(info.FestivalFieldId.Value, json.SearchText.PersianToEnglish(), json.Limit); //var list = await _candidateService.SearchCandidateAsync(userInfo.StateName, json.SearchText, json.Limit); var buttonSimpleList = new List <ButtonSimpleModel>(); foreach (var item in list) { buttonSimpleList.Add(new ButtonSimpleModel { Type = ButtonSimpleTypeEnum.TextOnly, Text = $"{item.Title}", ImageUrl = null }); } return(Ok(new { items = buttonSimpleList })); } return(CustomResult()); } catch (Exception exception) { return(CustomError(exception)); } }