public ManufacturerTypeSearchHandlerResponse Get(ManufacturerTypeSearchHandlerRequest request)
 {
     return new ManufacturerTypeSearchHandlerResponse
     {
         Results = new[]
         {
             new ManufacturerType
             {
                 HasFixedQueueSize = true,
                 Id = 1,
                 Name = "Factory",
                 QueueSize = 3,
                 SupportsParallelManufacturing = true,
                 ProductTypes = new[]
                 {
                     new ProductType
                     {
                         Id = 1,
                         ManufacturerTypeId = 1,
                         Name = "Metal",
                         TimeToManufacture = 1
                     }
                 }
             }
         }
     };
 }
 private RepositoryRequest<Domain.ManufacturerType> CreateRepositoryRequest(ManufacturerTypeSearchHandlerRequest request)
 {
     if (request.Id.HasValue)
         return new RepositoryRequest<Domain.ManufacturerType>
         {
             Expression = x=> x.Id.Equals(request.Id.Value)
         };
     return new RepositoryRequest<Domain.ManufacturerType>
     {
         Expression = x=> x.Name.Equals(request.Name)
     };
 }
 public ManufacturerTypeSearchHandlerResponse Get(ManufacturerTypeSearchHandlerRequest request)
 {
     if (request.Id.HasValue || !string.IsNullOrWhiteSpace(request.Name))
     {
         var queryable = _manufacturerTypeUnitOfWork.ManufacturerTypeRepository.Get(CreateRepositoryRequest(request));
         return new ManufacturerTypeSearchHandlerResponse
         {
             Results = queryable.Select(Mapper.Map<ManufacturerType>).ToArray()
         };
     }
     var manufacturerTypes = _manufacturerTypeUnitOfWork.ManufacturerTypeRepository.Get().ToArray();
     return new ManufacturerTypeSearchHandlerResponse
     {
         Results = manufacturerTypes.Select(Mapper.Map<ManufacturerType>).ToArray()
     };
 }
        // GET api/InventoryItems
        public IQueryable<ManufacturerType> Get()
        {
            try
            {
                var request = new HandlerEntities.ManufacturerTypeSearchHandlerRequest();
                var manufacturerTypeSearchHandlerResponse = _manufacturerTypeHandler.Get(request);
                var manufacturerTypes = manufacturerTypeSearchHandlerResponse.Results.Select(Mapper.Map<ManufacturerType>).ToList();
                var manufacturerType = new ManufacturerType
                {
                    Id = manufacturerTypes.Count,
                    Name = "All",
                    ProductTypes = manufacturerTypeSearchHandlerResponse.Results.SelectMany(x => x.ProductTypes).OrderBy(x => x.Name).Select(Mapper.Map<ProductType>).ToArray()
                };
                manufacturerTypes.Insert(0, manufacturerType);

                return manufacturerTypes.AsQueryable();
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
 // GET api/InventoryItems/5
 public ManufacturerType Get(int id)
 {
     var request = new HandlerEntities.ManufacturerTypeSearchHandlerRequest();
     var manufacturerTypeSearchHandlerResponse = _manufacturerTypeHandler.Get(request);
     return Mapper.Map<ManufacturerType>(manufacturerTypeSearchHandlerResponse.Results.FirstOrDefault());
 }