Ejemplo n.º 1
0
        protected void PrepareOfficeAssociationModel(IBranchOfficeAssociation model, BaseEntity entity, 
            IBranchOfficeService officeService, ICacheManager cacheManager)
        {
            var associatedOffices = entity.GetAttribute<List<Guid>>(SystemAttributeNames.AssociatedBrancOffices);

            if (associatedOffices != null && associatedOffices.Count > 0)
            {
                var availableOffices = PrepareSelectList(officeService, cacheManager);
                model.Offices = availableOffices
                    .Where(o => associatedOffices.Contains(new Guid(o.Value)))
                    .Select(o => o.Text)
                    .ToList();
            }
            else
                model.Offices = new List<string>();
        }