예제 #1
0
파일: User.cs 프로젝트: Traan/Repeatly
        public async static Task <CloudBlockBlob> SaveAsync(HttpRequest request, CloudBlobContainer userContainer)
        {
            var principal = await StaticWebAppsAuth.GetClientPrincipalAsync(request);

            var blob = GetBlob(principal, userContainer);

            var requestBody = await new StreamReader(request.Body).ReadToEndAsync();
            var user        = JsonConvert.DeserializeObject <User>(requestBody);

            user.ClientPrincipal = principal;

            await SaveAsync(blob, user);

            return(blob);
        }
예제 #2
0
파일: User.cs 프로젝트: Traan/Repeatly
        public async static Task <CloudBlockBlob> GetBlobAsync(HttpRequest request, CloudBlobContainer userContainer)
        {
            var principal = await StaticWebAppsAuth.GetClientPrincipalAsync(request);

            var blob       = GetBlob(principal, userContainer);
            var blobExists = await blob.ExistsAsync();

            if (!blobExists)
            {
                var user = new User
                {
                    ClientPrincipal = principal
                };

                await SaveAsync(blob, user);
            }

            return(blob);
        }