Exemplo n.º 1
0
 /// <summary>
 /// Find tasks in database using fulltext search
 /// </summary>
 /// <param name="searchModel">Search model wic represents the result</param>
 /// <returns></returns>
 public SearchModel SearchTasks(SearchModel searchModel)
 {
     String query = "select TaskId from [dbo].[Tasks] where contains(*, @param)";
     var searchReults = db.Database.SqlQuery<int>(query, new SqlParameter("param", "\"" + searchModel.Value + "*\"")).ToList();
     searchModel.SearchResult = new List<Task>();
     foreach (var searchReult in searchReults)
     {
         searchModel.SearchResult.Add(FindTask(searchReult));
     }
     return searchModel;
 }
Exemplo n.º 2
0
 public ActionResult Search(SearchModel searchModel)
 {
     return View(data.SearchTasks(searchModel));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Get the model whitch represents results of search tasks by tag name
 /// </summary>
 /// <param name="tagName">Tag name</param>
 /// <returns></returns>
 public SearchModel GetSearhByTagModel(string tagName)
 {
     SearchModel search = new SearchModel();
     var tags = db.Categories.Where(t => t.Name == tagName).Select(t => t).ToList();
     search.SearchResult = db.Tasks.Where(t => t.Categories.Where(tt => tt.Name == tagName).Select(tt => tt).Count() != 0).ToList();
     return search;
 }