/// <summary>
        ///     Adds the kindAction.
        /// </summary>
        /// <param name="kindAction">
        ///     The kindAction.
        /// </param>
        /// <returns>
        ///     Task{AddResult}.
        /// </returns>
        public async Task <IdResult> AddKindAction(KindAction kindAction)
        {
            kindAction.Id = Guid.NewGuid().ToString("N");
            var azureModel = kindAction.ToAzureModel();

            return(await _azureManager.AddEntityAsync(azureModel));
        }
        /// <summary>
        ///     Adds the appErrorInfo.
        /// </summary>
        /// <param name="appErrorInfo">
        ///     The appErrorInfo.
        /// </param>
        /// <returns>
        ///     Task{AddResult}.
        /// </returns>
        public async Task <IdResult> AddAppErrorInfo(AppErrorInfo appErrorInfo)
        {
            appErrorInfo.Id = Guid.NewGuid().ToString("N");
            var azureModel = appErrorInfo.ToAzureModel();

            return(await _azureManager.AddEntityAsync(azureModel));
        }
Esempio n. 3
0
        public async Task <Core.CommonModels.Results.OperationResult> PostMessageToDevelopers(string userId, string message)
        {
            var userData = new UserData(AzureTableConstants.UserDataMessage)
            {
                Text = message, UserId = userId
            };

            return(await _azureManager.AddEntityAsync(userData));
        }
        /// <summary>
        ///     Adds the mission draft.
        /// </summary>
        /// <param name="mission">
        ///     The mission.
        /// </param>
        /// <returns>
        ///     Task{AddResult}.
        /// </returns>
        public async Task <IdResult> AddMissionDraft(MissionDraft mission)
        {
            mission.Id = Guid.NewGuid().ToString();
            var missionDraft = mission.ToAzureModel();
            var typeLinks    = GeneratePersonQualityLinks(mission);

            missionDraft.PhotoUrl = await _imagesProvider.SaveImageToProductionBlobOnAdd(missionDraft.PhotoUrl, BlobContainer.MissionDraftImages);

            if (!typeLinks.Any())
            {
                return(await _azureManager.AddEntityAsync(missionDraft));
            }

            typeLinks.Insert(0, missionDraft);
            return(await _azureManager.AddEntityBatchAsync(typeLinks));
        }
Esempio n. 5
0
        /// <summary>
        ///     Adds the user identity.
        /// </summary>
        /// <param name="userIdentity">The user identity.</param>
        /// <returns>Task{AddResult}.</returns>
        public async Task <IdResult> AddUserIdentity(UserIdentity userIdentity)
        {
            var checkExistanceResult = await CheckIdentityExist(userIdentity);

            if (!String.IsNullOrEmpty(checkExistanceResult.Id))
            {
                return(new IdResult(checkExistanceResult.Id)
                {
                    Description = "Specified identity is already in use",
                    Status = OperationResultStatus.Warning
                });
            }

            userIdentity.Id = Guid.NewGuid().ToString("N");
            var userIdentityAzure = userIdentity.ToAzureModel();

            return(await _azureManager.AddEntityAsync(userIdentityAzure));
        }
Esempio n. 6
0
        /// <summary>
        ///     Adds the missionRequest.
        /// </summary>
        /// <param name="missionRequest">
        ///     The missionRequest.
        /// </param>
        /// <returns>
        ///     Task{AddResult}.
        /// </returns>
        public async Task <IdResult> AddMissionRequest(MissionRequest missionRequest)
        {
            missionRequest.Id = Guid.NewGuid().ToString("N");
            if (missionRequest.Proof.ImageUrls != null)
            {
                var newUrlsTasks =
                    missionRequest.Proof.ImageUrls.Select(
                        async url =>
                        await _imagesProvider.SaveImageToProductionBlobOnAdd(url, BlobContainer.MissionRequestImages));
                var newUrls = await Task.WhenAll(newUrlsTasks);

                missionRequest.Proof.ImageUrls = newUrls.ToList();
            }

            var azureModel = missionRequest.ToAzureModel();

            return(await _azureManager.AddEntityAsync(azureModel));
        }
 /// <summary>
 ///     Adds the type of the person.
 /// </summary>
 /// <param name="personQuality">Type of the person.</param>
 /// <returns>Task{AddResult}.</returns>
 public async Task <IdResult> AddPersonQuality(PersonQuality personQuality)
 {
     personQuality.Id = Guid.NewGuid().ToString("N");
     return(await _azureManager.AddEntityAsync(personQuality.ToAzureModel()));
 }
        /// <summary>
        ///     Adds the alias.
        /// </summary>
        /// <param name="alias">The alias.</param>
        /// <returns>Task{AddResult}.</returns>
        public async Task <IdResult> AddAlias(CommonPlaceAlias alias)
        {
            var azureModel = alias.ToAzureModel();

            return(await _azureManager.AddEntityAsync(azureModel));
        }
 /// <summary>
 /// Adds the hint request.
 /// </summary>
 /// <param name="hintRequest">The hint request.</param>
 /// <returns></returns>
 public async Task <IdResult> AddHintRequest(HintRequest hintRequest)
 {
     return(await _azureManager.AddEntityAsync(hintRequest.ToAzureModel()));
 }