using FHT.Core.Queries.ImplementedInterfaces; using FHT.MvcCommon; using System.Web.Mvc; namespace FHT.Agency.Web.Controllers { public class TopicPostController : Controller { private readonly ITopicPostQuery _topicPostQuery; public TopicPostController(ITopicPostQuery topicPostQuery) { _topicPostQuery = topicPostQuery; } #region AutoComplete [HttpGet] [IsAjaxJsonResult] public JsonResult AutoCompleteSearch(string q, int? id) { if (id.HasValue) { Core.UI.ViewModels.AutoCompleteViewModel company = _topicPostQuery.GetSelectListItemById(id.Value); return Json(company, JsonRequestBehavior.AllowGet); } else { System.Collections.Generic.List companys = _topicPostQuery.SearchSelectListItem(q); return Json(companys, JsonRequestBehavior.AllowGet); } } #endregion } }