Exemplo n.º 1
0
        /// <summary>
        /// Posts the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        public Task Post(PostUserImage request)
        {
            var userId = GetPathValue(1);

            AssertCanUpdateUser(_authContext, _userManager, new Guid(userId), true);

            request.Type = (ImageType)Enum.Parse(typeof(ImageType), GetPathValue(3), true);

            var item = _userManager.GetUserById(userId);

            return(PostImage(item, request.RequestStream, request.Type, Request.ContentType));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Posts the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        public Task Post(PostUserImage request)
        {
            var id = Guid.Parse(GetPathValue(1));

            AssertCanUpdateUser(_authContext, _userManager, id, true);

            request.Type = Enum.Parse <ImageType>(GetPathValue(3).ToString(), true);

            var item = _userManager.GetUserById(id);

            return(PostImage(item, request.RequestStream, request.Type, Request.ContentType));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Posts the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        public void Post(PostUserImage request)
        {
            var id = new Guid(GetPathValue(1));

            request.Type = (ImageType)Enum.Parse(typeof(ImageType), GetPathValue(3), true);

            var item = _userManager.GetUserById(id);

            var task = PostImage(item, request.RequestStream, request.Type, Request.ContentType);

            Task.WaitAll(task);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Posts the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        public void Post(PostUserImage request)
        {
            var pathInfo = PathInfo.Parse(Request.PathInfo);
            var id       = new Guid(pathInfo.GetArgumentValue <string>(1));

            request.Type = (ImageType)Enum.Parse(typeof(ImageType), pathInfo.GetArgumentValue <string>(3), true);

            var item = _userManager.GetUserById(id);

            var task = PostImage(item, request.RequestStream, request.Type, Request.ContentType);

            Task.WaitAll(task);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Posts the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        public void Post(PostUserImage request)
        {
            var userId = GetPathValue(1);

            AssertCanUpdateUser(_authContext, _userManager, userId, true);

            request.Type = (ImageType)Enum.Parse(typeof(ImageType), GetPathValue(3), true);

            var item = _userManager.GetUserById(userId);

            var task = PostImage(item, request.RequestStream, request.Type, Request.ContentType);

            Task.WaitAll(task);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Posts the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        public Task Post(PostUserImage request)
        {
            var userId      = GetPathValue(1);
            var user        = _userManager.GetUserById(userId);
            var accessToken = _authContext.GetAuthorizationInfo(Request);

            if (accessToken.Account == null || user.AccountId != accessToken.Account.Id)
            {
                AssertCanUpdateUser(_authContext, _userManager, new Guid(userId), true);
            }

            request.Type = (ImageType)Enum.Parse(typeof(ImageType), GetPathValue(3), true);

            return(PostImage(user, request.RequestStream, request.Type, Request.ContentType));
        }