public ActionResult OtherProfile(int userId)
        {
            ViewData["userId"] = userId;

            _postBusiness = new PostBusiness();
            _iconBusiness = new IconBusiness();
            _profileBusiness = new ProfileBusiness();
            _registerBusiness = new RegisterBusiness();

            UserProfile _userProfile = _profileBusiness.getProfileInfo(userId);

            int _registerId = (int)_userProfile.UserRegisterID;
            int _iconId = (int)_userProfile.IconID;

            UserRegister _userRegister = _registerBusiness.findById(_registerId);

            string _userRegisterName = _userRegister.Name;
            string _userRegisterSurname = _userRegister.Surname;

            try
            {
                ViewData["registerName"] = _userRegisterName;
                ViewData["registerSurname"] = _userRegisterSurname;
                ViewData["pathImage"] = _iconBusiness.getIconUrl(_iconId);
                ViewData["postDatabase"] = _postBusiness.getUserArticlePost(userId);
            }
            catch (Exception ex)
            {
            }

            return View();
        }
Esempio n. 2
0
        public ActionResult MainPage()
        {
            _postBusiness = new PostBusiness();

            ViewData["postDatabase"] = _postBusiness.getAllArticlePost();

            ViewData["pathImage"] = "/Content/Image/Icons/iconFamale3.gif";

            return View();
        }
        public ActionResult PartialShareArticle(ViewModel model)
        {
            _postBusiness = new PostBusiness();

            string currentDate = DateTime.Today.ToShortDateString();
            model.article.PostDate = currentDate;

            model.article.PostOwnerID = (int)Session["UserId"];

            model.article.PostLikeCount = 0;
            model.article.PostCommentID = 0;

            _postBusiness.insertArticlePost(model.article);

            return Redirect("~/Profile/Profile");
        }
        public ActionResult Profile()
        {
            _userId = -1;

            _postBusiness = new PostBusiness();
            _iconBusiness = new IconBusiness();
            _profileBusiness = new ProfileBusiness();

            try
            {
                _userId = (int)Session["UserId"];
                _iconId = (int)_profileBusiness.getProfileInfo(_userId).IconID;

                ViewData["pathImage"] = _iconBusiness.getIconUrl(_iconId);
                ViewData["postDatabase"] = _postBusiness.getUserArticlePost(_userId);
            }
            catch(Exception ex)
            {
            }
            return View();
        }