Пример #1
0
        // POST api/PostureLevel
        public IHttpActionResult Post([FromBody] PostureLevelViewModel model)
        {
            try
            {
                PostureLevelsService.AddUserPostureLevel(model, User.Identity.GetUserId());
            }
            catch (NullReferenceException ex)
            {
                return(BadRequest());
            }

            return(Ok());
        }
Пример #2
0
        // GET api/PostureLevel/5
        public IHttpActionResult Get(int id)
        {
            try
            {
                PostureLevelsService.AddUserPostureLevel(new PostureLevelViewModel
                {
                    UserId = "74b43350-8275-42ae-91b3-152ae1944328",
                    Level  = id
                }, "74b43350-8275-42ae-91b3-152ae1944328");
            }
            catch (NullReferenceException ex)
            {
                return(BadRequest());
            }

            return(Ok());
        }
Пример #3
0
        // GET api/PostureLevel/Current
        public PostureLevelViewModel GetCurrentLevel()
        {
            string userId = User.Identity.GetUserId();

            return(PostureLevelsService.GetUserCurrentLevel(userId));
        }
Пример #4
0
        // GET api/PostureLevel
        public IEnumerable <PostureLevel> Get()
        {
            string userId = User.Identity.GetUserId();

            return(PostureLevelsService.GetUserPostureLevels(userId));
        }