private void SetLoggedUserForAccountUserModel(MyArticlesModel myArticlesModel) { long lUserId = GetLoggedUserId(); User loggedUser = null; IEnumerable <UserArticles> userArticlesList = null; List <Article> articleList = null; if (myArticlesModel != null && lUserId > -1) { loggedUser = _repositoryWrapper.Account.GetUser(lUserId); loggedUser.Password = string.Empty; loggedUser.Id = -1; myArticlesModel.User = loggedUser; userArticlesList = _repositoryWrapper.UserArticles.GetUserArticles(lUserId); if (userArticlesList != null && userArticlesList.Count() > 0) { articleList = _repositoryWrapper.Articles.GetArticles(userArticlesList); SetCategoryForUserArticles(articleList); myArticlesModel.UserArticleList = articleList; } } }
public IActionResult GetMyArticleView() { MyArticlesModel myArticlesModel = new MyArticlesModel(); SetLoggedUserForAccountUserModel(myArticlesModel); return(View("My", myArticlesModel)); }