forked from FarmMaps/FarmMapsApiClient
Added ability to query for herbicide agents.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using FarmmapsApi.Models;
|
||||
using FarmmapsApi.Services;
|
||||
@@ -24,6 +26,18 @@ namespace FarmmapsHerbicide
|
||||
_generalService = generalService;
|
||||
}
|
||||
|
||||
public async Task<List<HerbicideAgent>> GetHerbicideAgents()
|
||||
{
|
||||
var itemType = "vnd.farmmaps.package.vra.herbicide";
|
||||
var vraHerbicideDataItems = await _farmmapsApiService.GetItemsAsync(string.Empty, itemType);
|
||||
|
||||
var item = vraHerbicideDataItems.FirstOrDefault();
|
||||
if (item == null)
|
||||
return null;
|
||||
|
||||
return item.Data.ContainsKey("agents") ? item.Data["agents"].ToObject<List<HerbicideAgent>>() : null;
|
||||
}
|
||||
|
||||
public async Task<Item> CalculateApplicationMapAsync(Item cropfieldItem, HerbicideAgent agent, params Item[] inputItem)
|
||||
{
|
||||
if (inputItem.Length == 0)
|
||||
|
Reference in New Issue
Block a user