private async Task Send() { var result = await loadingService.WithExecuteAsync("Data send", async() => { NetworkResult ret = null; foreach (var entity in allEntities) { if (entity.IsChecked) { var pair = await inspectionService.QueryInspectionAsync(entity.StorageNo); var request = new StorageDetailsRequest { Renew = false, StorageNo = entity.StorageNo, UserId = session.UserId, Entries = pair.Entities.Select(x => new StorageDetailsRequestEntry { ItemCode = x.ItemCode, ItemName = x.ItemName, SalesPrice = x.SalesPrice, Qty = x.Qty }).ToArray() }; ret = await networkClient.Post( EndPoint.StorageDetails(settingService.GetEndPoint()), request, Definition.Timeout); if (!ret.Success) { return(ret); } } await inspectionService.DeleteInspectionLisAsynct(entity.StorageNo); } return(ret); }); if (result.Success) { await dialogService.DisplayInformation("Data send", "Send completed."); await Back(); } else { await dialogService.DisplayNetworkError(result); } }
public async Task <bool> FlagQuote(DesignQuote quote, int flagReasonId) { try { var response = await httpClient.Post($"/api/v1/quotes/{quote.Id}/flag", new { flag_reason = flagReasonId }); if (!response.IsSuccessStatusCode) { var responseMessae = await response.Content.ReadAsStringAsync(); Utils.LogError(new Exception(responseMessae), "ErrorFlaggingQuote"); } return(response.IsSuccessStatusCode); } catch (Exception ex) { Utils.LogError(ex, "ErrorFlagingQuote"); return(false); } }
public async Task AddColor(Color color, string deviceId = null) { var response = await httpClient.Post("/api/v1/colors", new { primary_color = color.PrimaryColor.ToUpper(), secondary_color = color.SecondaryColor.ToUpper(), device_id = deviceId }); if (!response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); throw new Exception(content); } }