Esempio n. 1
0
        public static int GetCatalogId(this AutomobileBase entity, IEntityLookup lookup)
        {
            if (lookup == null)
            {
                throw new ArgumentNullException(nameof(lookup));
            }
            var catalogId = 0;

            switch (entity)
            {
            case AutomobileInfo:
                var autoCat = lookup.GetEntities <NoteCatalog>()
                              .FirstOrDefault(cat => cat.Name == AutomobileConstant.AutoMobileInfoCatalogName);
                if (autoCat != null)
                {
                    catalogId = autoCat.Id;
                }
                break;

            case GasDiscount:
                var discountCat = lookup.GetEntities <NoteCatalog>()
                                  .FirstOrDefault(cat => cat.Name == AutomobileConstant.GasDiscountCatalogName);
                if (discountCat != null)
                {
                    catalogId = discountCat.Id;
                }
                break;

            case GasLog:
                var logCat = lookup.GetEntities <NoteCatalog>()
                             .FirstOrDefault(cat => cat.Name == AutomobileConstant.GasLogCatalogName);
                if (logCat != null)
                {
                    catalogId = logCat.Id;
                }
                break;

            default:
                catalogId = 0;
                break;
            }

            return(catalogId);
        }
Esempio n. 2
0
 public PageList <Author> GetEntities(Expression <Func <Author, bool> > query = null, ResourceCollectionParameters resourceCollectionParameters = null)
 {
     return(_lookupRepo.GetEntities(query, resourceCollectionParameters));
 }