示例#1
0
        public HttpResponseMessage GetWinner()
        {
            BlipUser user = BlipRepo.Current.GetWinner();


            return(Request.CreateResponse(HttpStatusCode.OK, new { Winner = user }));
        }
示例#2
0
        public HttpResponseMessage Create(LoginModel model)
        {
            BlipUser user = new BlipUser
            {
                Avatar   = model.Avatar,
                UserName = model.UserName,
            };

            user = BlipRepo.Current.AddUser(user);

            return(Request.CreateResponse(HttpStatusCode.OK, user));
        }
示例#3
0
        public HttpResponseMessage GetAll()
        {
            BlipUser user = GetUser();

            List <UserFeed> feed = FeedRepo.Current.GetAll();

            feed.Sort((x, y) => y.FeedId - x.FeedId);

            FeedViewModel model = new FeedViewModel
            {
                Feed    = feed,
                Comment = "",
                User    = user
            };

            return(Request.CreateResponse(HttpStatusCode.OK, model));
        }
示例#4
0
        private BlipUser GetUser()
        {
            BlipUser user = null;

            try
            {
                System.Console.WriteLine("Api Session ID: {0}", System.Web.HttpContext.Current.Session.SessionID);
                user = System.Web.HttpContext.Current.Session["CurrentUser"] as BlipUser;
            }
            catch (Exception e)
            {
                //TODO fix this
                user = new BlipUser
                {
                    Avatar   = "av1.PNG",
                    UserId   = 0,
                    UserName = "******"
                };
            }

            return(user);
        }