public List<HubAllocationByRegionViewModel> BindAllocation(List<AllocationByRegion> reliefRequisitions) { try { if (reliefRequisitions == null) return new List<HubAllocationByRegionViewModel>(); //var result = (reliefRequisitions.Select(req => new HubAllocationByRegionViewModel() //{ // Region = req.Name, // RegionId = (int)req.RegionID, // AdminUnitID = (int)req.RegionID, // Hub = req.Hub, // AllocatedAmount = ((decimal)req.Amount).ToPreferedWeightUnit() //})); var r = new List<HubAllocationByRegionViewModel>(); foreach (var allocationByRegion in reliefRequisitions) { var allc = new HubAllocationByRegionViewModel(); allc.Region = allocationByRegion.Name; allc.RegionId = (int) allocationByRegion.RegionID; allc.AdminUnitID = (int) allocationByRegion.RegionID; allc.Hub = allocationByRegion.Hub; allc.AllocatedAmount = ((decimal) allocationByRegion.Amount).ToPreferedWeightUnit(); r.Add(allc); } return Enumerable.Cast<HubAllocationByRegionViewModel>(r).ToList(); } catch { return new List<HubAllocationByRegionViewModel>(); } }