Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
             };
         }

     }
Posted
Updated 23-Aug-22 9:47am

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900