コード例 #1
0
        public ActionResult MainPage()
        {
            //GEÇERLİ OTURUMU AÇMIŞ KİŞİNİN ID' SİNİ ALIP POST SAHİBİ KİŞİ İLE KONTROL ETTİRME İŞLEMİ.
            TempData["currentUserId"] = (int)Session["userId"];

            foreach (var articleItem in _postBusiness.getAllArticlePost())
            {
                _postModel = new PostModel();

                _postModel.UserID         = (int)_profileBusiness.getProfileInfo(articleItem.PostOwnerID).UserID;
                _postModel.UserRegisterID = (int)_profileBusiness.getProfileInfo(articleItem.PostOwnerID).UserRegisterID;
                _postModel.IconID         = (int)_profileBusiness.getProfileInfo(articleItem.PostOwnerID).IconID;

                _postModel.Name    = _registerBusiness.findById(_postModel.UserRegisterID).Name;
                _postModel.Surname = _registerBusiness.findById(_postModel.UserRegisterID).Surname;

                _postModel.IconUrl = _iconBusiness.getIconUrl(_postModel.IconID);

                _postModel.PostHeader  = articleItem.PostHeader;
                _postModel.PostContent = articleItem.PostContent;
                _postModel.PostDate    = articleItem.PostDate;
                _postModel.PostOwnerID = articleItem.PostOwnerID;

                _postModelList.Add(_postModel);
            }

            return(View(_postModelList));
        }
コード例 #2
0
        public ActionResult Profile()
        {
            try
            {
                _profileModel.CurrentUserID  = (int)Session["userId"];
                _profileModel.UserRegisterID = _loginBusiness.findRegisterIdByUserId(_profileModel.CurrentUserID);

                _profileModel.Name        = _registerBusiness.findById(_profileModel.UserRegisterID).Name;
                _profileModel.Surname     = _registerBusiness.findById(_profileModel.UserRegisterID).Surname;
                _profileModel.CountryName = _countryBusiness.getCountryNameById((int)(_registerBusiness.findById(_profileModel.UserRegisterID).CountryID));

                _profileModel.IconUrl = _iconBusiness.getIconUrl((int)_profileBusiness.getProfileInfo(_profileModel.CurrentUserID).IconID);

                _profileModel.SharingsCount  = _postBusiness.getUserArticlePost(_profileModel.CurrentUserID).Count;
                _profileModel.FollowersCount = _profileBusiness.getAllFollowerByProfileId(_profileBusiness.getProfileId(_profileModel.CurrentUserID)).Count;

                return(View(_profileModel));
            }
            catch (Exception ex)
            {
                return(View(new ProfileModel()));
            }
        }