I have a global variable list called objCustomerData I want to be able to return distinct data in GetBranch method.
This is not happening. It is returning all the duplicates. I want it to return just distinct branches.
Please what am I doing wrong here?
        private List<Customer> objCustomerData;
        public ActionResult Index()
        {
            InventoryAssViewModel objModel = new InventoryAssViewModel();
            try
            {   
                 if (countryValue == "CA")
                {
                    objCustomerData = _inventoryService.GetListCountryData("CAA");
                    objModel.BranchModel = GetBranch();
                }
                else 
                {
                    objCustomerData = _inventoryService.GetListCountryData("NIG");                 
                }
            }
            catch (Exception ex)
            {
            }
            return View(objModel);
        }
        public List<Branch> GetBranch()
        {
            List<Branch> filterBranch;
            try
            {
                filterBranch = (from c in objCustomerData
                    select new Branch()
                    {
                        Id = c.Branch,
                        BranchName = c.Branch
                    }).Distinct().ToList();
            }
            catch (Exception)
            {               
                throw;
            }
            return filterBranch;
        }
 
    