mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-22 11:21:47 -05:00
Don't dispose the db context.
This commit is contained in:
parent
97e67c021d
commit
908b50cb47
1 changed files with 11 additions and 10 deletions
|
@ -40,16 +40,17 @@ public ActionResult Search(string query)
|
|||
{
|
||||
var result = new SearchResult();
|
||||
query = query.ToLower();
|
||||
using(var db = new ApplicationDbContext())
|
||||
{
|
||||
result.Downloads = db.Downloads.Where(x => x.Name.ToLower().Contains(query) || x.Changelog.ToLower().Contains(query));
|
||||
result.ForumTopics = db.ForumTopics.Where(x => x.Subject.ToLower().Contains(query));
|
||||
result.Skins = db.Skins.Where(x => x.Name.ToLower().Contains(query) || x.ShortDescription.ToLower().Contains(query) || x.FullDescription.ToLower().Contains(query));
|
||||
result.Users = db.Users.Where(x => x.DisplayName.ToLower().Contains(query)||x.Bio.ToLower().Contains(query)||x.Interests.ToLower().Contains(query)||x.Hobbies.ToLower().Contains(query));
|
||||
result.WikiPages = db.WikiPages.Where(x => x.Name.ToLower().Contains(query) || x.Contents.ToLower().Contains(query));
|
||||
//Holy crap that search was... long.
|
||||
return View(result);
|
||||
}
|
||||
var db = new ApplicationDbContext();
|
||||
|
||||
|
||||
result.Downloads = db.Downloads.Where(x => x.Name.ToLower().Contains(query) || x.Changelog.ToLower().Contains(query));
|
||||
result.ForumTopics = db.ForumTopics.Where(x => x.Subject.ToLower().Contains(query));
|
||||
result.Skins = db.Skins.Where(x => x.Name.ToLower().Contains(query) || x.ShortDescription.ToLower().Contains(query) || x.FullDescription.ToLower().Contains(query));
|
||||
result.Users = db.Users.Where(x => x.DisplayName.ToLower().Contains(query) || x.Bio.ToLower().Contains(query) || x.Interests.ToLower().Contains(query) || x.Hobbies.ToLower().Contains(query));
|
||||
result.WikiPages = db.WikiPages.Where(x => x.Name.ToLower().Contains(query) || x.Contents.ToLower().Contains(query));
|
||||
//Holy crap that search was... long.
|
||||
return View(result);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue