Exemple #1
0
        public IEnumerable <Trancport> SearchTrancport(TypeSearchTrancport type, string text)
        {
            switch (type)
            {
            case TypeSearchTrancport.Make:
            {
                return(_logic.GetTrancports().Where(x => x.Make.Name.Contains(text)).ToList());
            }

            case TypeSearchTrancport.Model:
            {
                return(_logic.GetTrancports().Where(x => x.Model.Name.Contains(text)).ToList());
            }

            case TypeSearchTrancport.Vin:
            {
                return(_logic.GetTrancports().Where(x => x.Vin.Contains(text)).ToList());
            }

            case TypeSearchTrancport.Empty:
            {
                return(_logic.GetTrancports().ToList());
            }

            default:
                throw new NotImplementedException($"Not Implemented search for{type}");
            }
        }
Exemple #2
0
        public IEnumerable <ITrancport> SearchTrancports(TypeSearchTrancport type, string text)
        {
            try
            {
                using (var context = IoC.Resolve <IAimpContext>())
                {
                    switch (type)
                    {
                    case TypeSearchTrancport.Make:
                    {
                        return(context.Trancports.All(x => x.Make, x => x.Model, x => x.Category, x => x.EngineType, x => x.Type)
                               .Where(x => x.Make.Name.Contains(text)).ToList());
                    }

                    case TypeSearchTrancport.Model:
                    {
                        return(context.Trancports.All(x => x.Make, x => x.Model, x => x.Category, x => x.EngineType, x => x.Type)
                               .Where(x => x.Model.Name.Contains(text)).ToList());
                    }

                    case TypeSearchTrancport.Vin:
                    {
                        return(context.Trancports.All(x => x.Make, x => x.Model, x => x.Category, x => x.EngineType, x => x.Type)
                               .Where(x => x.Vin.Contains(text)).ToList());
                    }

                    case TypeSearchTrancport.Empty:
                    {
                        return(context.Trancports.All(x => x.Make, x => x.Model, x => x.Category, x => x.EngineType, x => x.Type)
                               .ToList());
                    }

                    default:
                        throw new NotImplementedException($"Not Implemented search for type: {type}");
                    }
                }
            }
            catch (Exception ex)
            {
                LoggerProvider.Logger.Log(ex);
                throw;
            }
        }
 public SearchTrancportResult SearchTrancports(TypeSearchTrancport type, string text)
 {
     try
     {
         _WriteLineConsole($"Search trancport where {text}");
         using (var helper = new TransactionInfoHelper())
             return new SearchTrancportResult()
                    {
                        Trancports = helper.SearchTrancport(type, text)
                    };
     }
     catch (Exception ex)
     {
         _WriteLineError($"Search trancport where {text}", ex.Message);
         return(new SearchTrancportResult()
         {
             Error = true,
             Message = ex.Message
         });
     }
 }
Exemple #4
0
 public IEnumerable <ITrancport> SearchTrancports(TypeSearchTrancport type, string text)
 {
     throw new NotImplementedException();
 }