Open
Description
Hi,
I was wondering if it is possible to add methods to delete records from AFAS, such as Delete and DeleteAsync.
I think the implementation could be the same as for SaveAsync and UpdateAsync, just using HTTP DELETE method:
public async Task<UpdateResult<TResult>> DeleteAsync<TResult>(
IUpdateable<TResult> value,
string subitem = "")
{
GeneralBase generalBase = this;
string payload = AfasUpdateWriter.Write((IUpdateEntity) value, new IUpdateEntity[1]
{
(IUpdateEntity) value
});
string str1 = ConnectorNameAttribute.GetConnectorName<IUpdateable<TResult>>(value);
if (generalBase is RefineryClient)
str1 = str1.Replace("Tafas", "Pocket");
string urlPath = "connectors/" + str1;
if (subitem != "")
urlPath = urlPath + "/" + subitem;
HttpResponseMessage res = await generalBase.SendAuthHttp(urlPath, payload, HttpMethod.Delete);
string str2 = await res.Content.ReadAsStringAsync();
UpdateResult<TResult> updateResult = res.IsSuccessStatusCode ? UpdateResult<TResult>.CreateSuccess(str2) : UpdateResult<TResult>.CreateError(str2);
res = (HttpResponseMessage) null;
return updateResult;
}
It would be really useful for integration with AFAS and also implementing integration tests.
Metadata
Assignees
Labels
No labels