Ejemplo n.º 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();
        }
Ejemplo n.º 2
0
        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();
        }