Search by forum title

This commit is contained in:
Arti Zirk 2017-06-12 15:53:50 +03:00
parent 3707a8dce2
commit b1dcf5f72d
2 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BL.DTOs;
using BL.Factories;
using BL.Interfaces;
@ -64,7 +65,10 @@ namespace BL.Services
public IEnumerable<FoorumDTO> SearchFoorumTitle(string query)
{
throw new NotImplementedException();
foreach (var f in _foorumRepository.GetMany(f => f.Title.ToLower().Contains(query.ToLower())).OrderBy(f => f.CreationTime))
{
yield return _factory.Create(f);
}
}
public IEnumerable<PostDTO> SearchPostAuthor(string query)

View File

@ -18,9 +18,13 @@ namespace WebApi.Controllers
}
public IHttpActionResult Get(string author)
public IHttpActionResult GetAuthor(string author)
{
return Ok(_foorumService.SearchFoorumAuthor(author));
}
public IHttpActionResult GetTitle(string title)
{
return Ok(_foorumService.SearchFoorumTitle(title));
}
}
}