Example #1
0
        public async Task <IActionResult> GetBranchesList()
        {
            var result = await Task.Run(() =>
            {
                try
                {
                    var branchesList = BrancheHelper.GetBranches();
                    if (branchesList.Count() > 0)
                    {
                        dynamic expdoObj      = new ExpandoObject();
                        expdoObj.branchesList = branchesList;
                        return(Ok(new APIResponse {
                            status = APIStatus.PASS.ToString(), response = expdoObj
                        }));
                    }
                    else
                    {
                        return(Ok(new APIResponse {
                            status = APIStatus.FAIL.ToString(), response = "No Data Found for branches."
                        }));
                    }
                }
                catch (Exception ex)
                {
                    return(Ok(new APIResponse()
                    {
                        status = APIStatus.FAIL.ToString(), response = ex.Message
                    }));
                }
            });

            return(result);
        }
Example #2
0
 public IActionResult GetBranchesList()
 {
     try
     {
         var branchesList = BrancheHelper.GetBranches();
         if (branchesList.Count > 0)
         {
             dynamic expando = new ExpandoObject();
             expando.branchesList = branchesList.Select(n => new { ID = n.BranchCode, Text = n.BranchName });
             return(Ok(new APIResponse()
             {
                 status = APIStatus.PASS.ToString(), response = expando
             }));
         }
         else
         {
             return(Ok(new APIResponse()
             {
                 status = APIStatus.FAIL.ToString(), response = "No Data Found."
             }));
         }
     }
     catch (Exception ex)
     {
         return(Ok(new APIResponse()
         {
             status = APIStatus.FAIL.ToString(), response = ex.Message
         }));
     }
 }
Example #3
0
 public static List <TblBranch> GetBranchesList()
 {
     try
     {
         return(BrancheHelper.GetBranches().ToList());
     }
     catch { throw; }
 }
Example #4
0
 public IActionResult GetBranchList()
 {
     try
     {
         dynamic expnado = new ExpandoObject();
         expnado.branchesList = BrancheHelper.GetBranches();
         return(Ok(new APIResponse()
         {
             status = APIStatus.PASS.ToString(), response = expnado
         }));
     }
     catch (Exception ex)
     {
         return(Ok(new APIResponse()
         {
             status = APIStatus.FAIL.ToString(), response = ex.Message
         }));
     }
 }