Пример #1
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();
        }
Пример #3
0
        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");
        }