Пример #1
0
        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();
        }
Пример #2
0
        public ActionResult Icon(ViewModel model)
        {
            int userId = (int)Session["UserId"];
            _profileBusiness = new ProfileBusiness();
            UserProfile profile = new UserProfile();
            _loginBusiness = new LoginBusiness();

            profile = _profileBusiness.getProfileInfo(userId);

            profile.IconID = model.profile.IconID;

            _profileBusiness.updateIcon(profile);

            return View();
        }
        public ActionResult Register(ViewModel model)
        {
            _countryBusiness = new CountryBusiness();
            _registerBusiness = new RegisterBusiness();
            _loginBusiness = new LoginBusiness();
            _profileBusiness = new ProfileBusiness();
            List<UserRegister> listUserRegister;
            List<UserLogin> listUserLogin;

            DateTime dt = Convert.ToDateTime(model.register.BirthDate);

            model.register.BirthDate = dt.ToShortDateString();

            if (!_registerBusiness.checkUser(model.login))//Kullanıcı yoksa ekle.
            {
                _registerBusiness.addUser(model.register);

                listUserRegister = _registerBusiness.findID(model.register);
                model.login.UserRegisterID = listUserRegister[0].UserRegisterID;

                _loginBusiness.addUser(model.login);

                listUserLogin = _loginBusiness.findUser(model.login);
                model.profile.UserID = listUserLogin[0].UserID;

            model.profile.UserRegisterID = model.login.UserRegisterID;
            _profileBusiness.addProfile(model.profile);

                TempData["true"] ="kaydınız alınmıştır'" ;

                return Redirect("~/User/Login");
            }

            else {
                TempData["false"] = "kullanıcı adı daha önceden alınmış ya da kullanıcı adınızla şifreniz aynı" ;

            }

            ViewData["country"] = _countryBusiness.getAllCountry();
            return View();
        }
Пример #4
0
        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();
        }