public ClientParticipantListViewModel ClientApiModelToVM(ClientParticipantModel client) { return(new ClientParticipantListViewModel { ID = client.ID, Name = client.Name }); }
private string ReturnApiJsonForSearchByClient(ClientParticipantModel clientParticipant) { /* * {"where": {"contractClient": "resource:org.example.basic.HubClient#f874d863-aba7-448c-965f-f174cb80c01b"}} */ var jsonObj = (new[] { clientParticipant }).Select(x => { var xObj = new Newtonsoft.Json.Linq.JObject( new Newtonsoft.Json.Linq.JProperty("where", new Newtonsoft.Json.Linq.JObject( new Newtonsoft.Json.Linq.JProperty("contractClient", $"resource:{GetFullResource(x._Class, x.ID)}") )) ); return(xObj); }).First(); string json = JsonConvert.SerializeObject(jsonObj, Formatting.Indented); return(json); }
public async Task <(bool, string, IEnumerable <RentContractModelResponse>)> GetAllForClient(ClientParticipantModel clientParticipant) { var success = true; var errorMsg = string.Empty; var contractList = new List <RentContractModelResponse>().AsEnumerable(); try { var jsonContent = ReturnApiJsonForSearchByClient(clientParticipant); var urlEncoded = $"{ApiUrl}?filter={HttpUtility.UrlEncode(jsonContent)}"; var response = await SendRequestAsync <IEnumerable <RentContractModelResponse> >(RequestType.Get, urlEncoded); LogHelper.Info(Logger, $"{nameof(GetAllForClient)} - success: {response.Success} - message: {response.Message}"); if (!response.Success) { throw new Exception(response.Message); } else if (response.ResponseObj?.Count() > 0) { contractList = response.ResponseObj; } } catch (Exception ex) { LogHelper.Exception(Logger, $"{nameof(GetAllForClient)} Exception", ex); errorMsg = ex.Message; success = false; } return(success, errorMsg, contractList); }
public async Task <(bool, string)> Update(ClientParticipantModel participantData) { return(await base.Update(participantData)); }