/// <summary>
        ///     The update mission request.
        /// </summary>
        /// <param name="missionRequest">
        ///     The mission request.
        /// </param>
        /// <returns>
        ///     The <see cref="Task" />.
        /// </returns>
        public async Task <OperationResult> UpdateMissionRequest(MissionRequest missionRequest)
        {
            var existingMissionRequest = await GetMissionRequest(missionRequest.Id);

            if (existingMissionRequest == null)
            {
                return(OperationResult.NotFound);
            }

            missionRequest.CopyTo(existingMissionRequest);
            return(new OperationResult(OperationResultStatus.Success));
        }
Exemple #2
0
        /// <summary>
        ///     To the azure model.
        /// </summary>
        /// <param name="missionRequest">The mission request.</param>
        /// <returns>MissionRequestAzure</returns>
        public static MissionRequestAzure ToAzureModel(this MissionRequest missionRequest)
        {
            var azureModel = new MissionRequestAzure();

            missionRequest.CopyTo(azureModel);
            azureModel.StarsCount = missionRequest.StarsCount;
            azureModel.Status     = missionRequest.Status.ToString();
            //set proofs
            azureModel.ProofImageUrls   = missionRequest.Proof.ImageUrls?.JoinToString();
            azureModel.ProofCoordinates = missionRequest.Proof.Coordinates?.Select(coord => coord.ConvertToAzureCoordinate())
                                          .JoinToString(CommonConstants.Delimiter);
            azureModel.CreatedText   = missionRequest.Proof.CreatedText;
            azureModel.TimeElapsed   = missionRequest.Proof.TimeElapsed;
            azureModel.NumberOfTries = missionRequest.Proof.NumberOfTries;
            return(azureModel);
        }