public async Task <IActionResult> GetPupms(string pumpNo, string branchCode) { var result = await Task.Run(() => { try { string errorMessage = string.Empty; var pumpsList = new InvoiceHelper().GetPumps(pumpNo, branchCode); dynamic expando = new ExpandoObject(); expando.PumpsList = pumpsList.Select(x => new { ID = x.PumpId, TEXT = x.PumpNo }); return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = expando })); } catch (Exception ex) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = ex.Message })); } }); return(result); }