I have one Enum where i have defined three string
name
address
Date
and i have one method with one string parameter.
i want to use switch case
i am using post request in REST api. i want to use switch case and once use enter name or address or date so my code should be working and i need to get the result
please give me some nice suggestion.
i am sending my codes please check
What I have tried:
public enum SearchISD
{
InvoiceNumber,
ShukranNumber,
Date
}
private SearchISD _ISD;
public SearchISD ISD
{
get { return _ISD; }
set { _ISD = value; }
}
public async Task<ResponseResult<PrintResponse>> FetchPrintDataFromISD(string transactionId)
{
try
{
string url = $"{AppConstants.BASEURL}{string.Format(AppConstants.GetPrintReceiptUrl, transactionId)}";
var result = await restService.PostAsync<PrintResponse>(url, false);
return result;
}
catch (HttpException ex)
{
return new ResponseResult<PrintResponse>
{
ErrorMessage = ex.ErrorResponse.MoreInformation != null ? ex.ErrorResponse.MoreInformation.ToString() : ex.ErrorResponse.HttpMessage.ToString(),
ErrorCode = ex.ErrorResponse.HttpMessage,
ResponseStatus = false,
WebStatus = ex.ErrorResponse.WebStatus
};
}
catch (Exception ex)
{
return new ResponseResult<PrintResponse>
{
ErrorMessage = ex.Message,
ResponseStatus = false,
WebStatus = Status.Failed
};
}
}