Exemplo n.º 1
0
 public int Count <T>(Expression <Func <T, bool> > predicate = null)
 {
     // ReSharper disable ExpressionIsAlwaysNull
     // ReSharper disable SuspiciousTypeConversion.Global
     if (typeof(T) == typeof(Bought))
     {
         return(_boughtController.Count(predicate as Expression <Func <Bought, bool> >));
     }
     if (typeof(T) == typeof(CompanyEndings))
     {
         return(_companyEndingsController.Count(predicate as Expression <Func <CompanyEndings, bool> >));
     }
     if (typeof(T) == typeof(CompanyNames))
     {
         return(_companyNamesController.Count(predicate as Expression <Func <CompanyNames, bool> >));
     }
     if (typeof(T) == typeof(DummyCompany))
     {
         return(_dummyCompanyController.Count(predicate as Expression <Func <DummyCompany, bool> >));
     }
     if (typeof(T) == typeof(Merchant))
     {
         return(_merchantController.Count(predicate as Expression <Func <Merchant, bool> >));
     }
     if (typeof(T) == typeof(Names))
     {
         return(_namesController.Count(predicate as Expression <Func <Names, bool> >));
     }
     if (typeof(T) == typeof(Sold))
     {
         return(_soldController.Count(predicate as Expression <Func <Sold, bool> >));
     }
     if (typeof(T) == typeof(Stock))
     {
         return(_stockController.Count(predicate as Expression <Func <Stock, bool> >));
     }
     if (typeof(T) == typeof(StockHistory))
     {
         return(_stockHistoryController.Count(predicate as Expression <Func <StockHistory, bool> >));
     }
     if (typeof(T) == typeof(StockMarket))
     {
         return(_stockMarketController.Count(predicate as Expression <Func <StockMarket, bool> >));
     }
     if (typeof(T) == typeof(Surnames))
     {
         return(_surnamesController.Count(predicate as Expression <Func <Surnames, bool> >));
     }
     if (typeof(T) == typeof(Taxes))
     {
         return(_taxesController.Count(predicate as Expression <Func <Taxes, bool> >));
     }
     return(-1);
 }