Updated receiving of root items
This commit is contained in:
		| @@ -1,6 +1,7 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
| using System.Linq; | ||||
| using System.Net; | ||||
| using System.Net.Http; | ||||
| using System.Net.Http.Headers; | ||||
| @@ -95,7 +96,19 @@ namespace FarmmapsApi.Services | ||||
|  | ||||
|             var jsonString = await response.Content.ReadAsStringAsync(); | ||||
|  | ||||
|             return JsonConvert.DeserializeObject<List<UserRoot>>(jsonString); | ||||
|             var roots = JsonConvert.DeserializeObject<List<UserRoot>>(jsonString); | ||||
|             roots.ForEach(v => | ||||
|             { | ||||
|                 v.Name = GetSuffixFromSystemItemCode(v.Code); | ||||
|             }); | ||||
|              | ||||
|             return roots; | ||||
|         } | ||||
|          | ||||
|         private static string GetSuffixFromSystemItemCode(string itemCode) | ||||
|         { | ||||
|             string[] strArray = itemCode.Split(":"); | ||||
|             return strArray.Length == 2 ? strArray[1] : throw new ArgumentException("No system item code :" + itemCode); | ||||
|         } | ||||
|  | ||||
|         public async Task<Item> GetItemAsync(string itemCode, string itemType = null, JObject dataFilter = null) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user