Last active
January 14, 2020 12:43
-
-
Save berkdulger/5b54fe2e88f295b392013c20b547fe9a to your computer and use it in GitHub Desktop.
Code Review for a Sample C# Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IEnumerable<GitHubUser> FavoritesList() | |
{ | |
CookieHelper cookieHelper = new CookieHelper(this.HttpContext); | |
HttpCookie httpCookie = cookieHelper.SetAndGetHttpCookies(); | |
MyCookie myCookie = new MyCookie() | |
{ | |
ID = Convert.ToInt32(httpCookie["userId"]) | |
}; | |
List<GitUser> favoritesList = new List<GitUser>(); | |
using (var db = new GitHubContext()) | |
{ | |
var results = (from ch in db.CookiesHistory | |
where ch.UserId == myCookie.ID | |
select new { GitUserId = ch.GitUserId }); | |
foreach (var result in results) | |
{ | |
var user = (from u in db.GitUsers | |
where u.Id == result.GitUserId | |
select new { u }).First(); | |
favoritesList.Add(user.u); | |
} | |
} | |
return favoritesList; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment