Esempio n. 1
0
        public ActionResult Login(Users login)
        {
            Session["id"] = login.UserUniqueid;
            Session["userurl"] = login.PublicProfileUrl;
            Session["userfname"] = login.DisplayName;
            Session["userpic"] = login.PicLocation;

            #region

            /*          fake data to login for testing with out a internet connnectoin
            Session["id"] = "szaF9K6odR";
            Session["userurl"] = "http://www.linkedin.com/in/roshandhananajaya";
            Session["userfname"] = "Roshan Dhananajaya";
            Session["userpic"] = "its getting it from the database coz im not  a new user";
            */

            #endregion

            var current = new UserDataAccess();
            Users thisUser = current.GetUserInfo(Session["id"].ToString());
            if (thisUser == null)
            {
                current.InsertUserInfo(login);
            }

            return Json(login);
        }
Esempio n. 2
0
        public ActionResult FrequentUser()
        {
            var userDataAccess = new UserDataAccess();
            var userId = (string) Session["id"];

            Users thisUserInfo = userDataAccess.GetUserInfo(userId);

            var frequentUserList = (new UserFrequency()).FrequentUsers(thisUserInfo.Id);

            //          List<UserFrequency> ResultList = userDataAccess.

            return Json(new
                            {
                                Status = "SUCCESS",
                                Result = frequentUserList
                            }, JsonRequestBehavior.AllowGet);
        }
Esempio n. 3
0
        public JsonResult Userprofile(string id)
        {
            Users me = new Users();
            var current = new UserDataAccess();

                me = (id == null) ? current.GetUserInfo(Session["id"].ToString()) : current.GetUserInfo(id);

            return Json(me);
        }
Esempio n. 4
0
        public ActionResult UserInfo(string id)
        {
            // todo: get the user info using the *id* and return the approprieate userInfo json object

            var userDataAccess = new UserDataAccess();
            Users users = userDataAccess.GetUserInfo(id);

            return Json(new
                            {
                                // todo: code code code .............
                                user_info = users
                            }, JsonRequestBehavior.AllowGet);
        }
Esempio n. 5
0
        public ActionResult Index()
        {
            var userDataAccess = new UserDataAccess();
            var userId = (string) Session["id"];

            Users userInfo = userDataAccess.GetUserInfo(userId);

            return Json(new
                            {
                                userInfo.Reputation,
                                userInfo.CreationDate,
                                userInfo.DisplayName,
                                userInfo.Views,
                                userInfo.Upvotes,
                                userInfo.Downvotes,
                                userInfo.PublicProfileUrl
                            }, JsonRequestBehavior.AllowGet);
        }
Esempio n. 6
0
        public List<DSH.Access.DataModels.Post> GetUserPosts(string userUniqeId)
        {
            // Return Post of the paritculer user whos UniqeId is provided
            var userDataAccess = new UserDataAccess();
            var user = userDataAccess.GetUserInfo(userUniqeId);

            var userPost = from post in _dataContext.Posts
                           where post.OwnerUserId == user.Id && post.PostTypeId != (int)Access.DataModels.PostTypes.Comment && post.IsAnonymous==false
                           orderby post.LastActivityDate descending
                           select post;
            return Mapper.Map<List<DSH.DataAccess.Post>, List<DSH.Access.DataModels.Post>>((List<Post>) userPost.ToList().Take(10));
        }