Beispiel #1
0
        private static async Task <JToken> GetCurrentMTC()
        {
            var graphClient = GetGraphClient();
            var user        = await graphClient.GetCurrentUserAsync();

            var    dataJsonUrl = BlobUtil.GetBlobSasUri("public", "mtcs.json");
            var    mtcName     = string.Empty;
            var    userEmail   = user.Mail ?? string.Empty;
            JToken result      = null;

            using (var httpClient = new HttpClient())
            {
                var jsonStr = await httpClient.GetStringAsync(dataJsonUrl);

                var mtcJson = JsonConvert.DeserializeObject(jsonStr) as JObject;
                foreach (var mtc in mtcJson["mtcs"])
                {
                    if (GetPureJsonValue("email", mtc["manager"]).ToLower() == userEmail.ToLower())
                    {
                        result = mtc;
                        break;
                    }
                    if (GetPureJsonValue("email", mtc["adjuster"]).ToLower() == userEmail.ToLower())
                    {
                        result = mtc;
                        break;
                    }
                }
            }
            return(result);
        }
Beispiel #2
0
        public static async Task <string> GetMockImageFromBlob()
        {
            var currentMtc = await GetCurrentMTC();

            var mtcName          = currentMtc == null?string.Empty : GetPureJsonValue("name", currentMtc);
            var claimBlobImgName = string.Format("{0}_{1}", mtcName, Constants.blobImageName);
            var claimImage       = BlobUtil.GetBlobSasUri(Constants.pictureBlobcontainer, claimBlobImgName);

            return(claimImage);
        }