/// <summary>
        /// Performs a HTTP "POST" request to Create a Field.
        /// </summary>
        /// <returns></returns>
        public async Task CreateFieldPostRequestAsync() {
            var fieldPayload = new Field();
            string uri = BaseUrl + FieldModel.FIELDS_ENDPOINT;
            fieldPayload = fieldPayload.BuildRandomField();

            var postRequest = new ApiRequest<Field>(ApiConnection);
            await postRequest.MakeApiCall("POST", uri, fieldPayload);
        }
Пример #2
0
        public Field BuildRandomField()
        {
            Menus.PrintEachLetterToConsole("Generating random Field.....");

            Field demoField = new Field()
            {
                id = GenerateRandomFieldName(),
                farmId = NEW_FIELD_FARM_ID,
                acres = NEW_FIELD_ACRES,
                centerPoint = new CenterPoint(NEW_FIELD_LATITUDE, NEW_FIELD_LONGITUDE)
            };

            demoField.name = demoField.id;

            Menus.PrintEachLetterToConsole(String.Format("Field ID: {0,-20}", demoField.id));
            Menus.PrintEachLetterToConsole(String.Format("Field Name: {0,-20}", demoField.name));
            Menus.PrintEachLetterToConsole(String.Format("Field Farm ID: {0,-20}", demoField.farmId));
            Menus.PrintEachLetterToConsole(String.Format("Field Acres: {0,-20}", demoField.acres));
            Menus.PrintEachLetterToConsole(String.Format("Field Latitude: {0,-20}", demoField.centerPoint.Latitude));
            Menus.PrintEachLetterToConsole(String.Format("Field Longitude: {0,-20}", demoField.centerPoint.Longitude));
            Console.WriteLine();

            return demoField;
        }