StreetFoo.Client.ReportItem.PushServerUpdateAsync C# (CSharp) Method

PushServerUpdateAsync() private method

private PushServerUpdateAsync ( ) : System.Threading.Tasks.Task
return System.Threading.Tasks.Task
        internal async Task PushServerUpdateAsync()
        {
            this.Logger.Info("Pushing update for #{0} ({1})...", this.Id, this.Status);

            // what happened?
            if (this.Status == ReportItemStatus.Unchanged)
            {
                // no-op...
            }
            else if (this.Status == ReportItemStatus.New)
            {
                // insert...
                var service = new CreateReportServiceProxy();
                var result = await service.CreateReportAsync(this.Title, this.Description, this.Longitude, this.Latitude);

                // patch back the native ID, if it worked...
                if (!(result.HasErrors))
                    this.NativeId = result.NativeId;
                else
                    this.Logger.Warn("Failed to insert report: " + result.GetErrorsAsString());
            }
            else
                throw new NotSupportedException(string.Format("Cannot handle '{0}'.", this.Status));

            // push the image update...
            await PushServerImageUpdateAsync();

            // reset our flag...
            this.Status = ReportItemStatus.Unchanged;

            // set...
            var conn = StreetFooRuntime.GetUserDatabase();
            await conn.UpdateAsync(this);
        }