public HttpResponseMessage GetSearchableToolInventoryColumns(string codes = "")
 {
     using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
     {
         return(request.CreateResponse(HttpStatusCode.OK, ToolInventoryRepo.GetSelectedToolInventoryColumns(codes, true)));
     }
 }
 public HttpResponseMessage GetToolSetupSheet(int id)
 {
     using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
     {
         return(request.CreateResponse(HttpStatusCode.OK, ToolInventoryRepo.GetToolSetupSheet(id)));
     }
 }
 public HttpResponseMessage GetVendorInfo(int ID)
 {
     using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
     {
         return(request.CreateResponse(HttpStatusCode.OK, ToolInventoryRepo.GetVendorInfo(ID)));
     }
 }
 public HttpResponseMessage GetVendors(string searchTerm = "", int categoryID = 0)
 {
     using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
     {
         return(request.CreateResponse(HttpStatusCode.OK, ToolInventoryRepo.GetVendors(searchTerm, categoryID)));
     }
 }
 public HttpResponseMessage GetToolNames([FromQuery] LookUpRequest lookUpRequest)
 {
     using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
     {
         return(request.CreateResponse(HttpStatusCode.OK, ToolInventoryRepo.GetToolNames(lookUpRequest.SearchTerm)));
     }
 }
 public HttpResponseMessage GetToolCuttingMethods(int ToolID, bool allMethods = true)
 {
     using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
     {
         return(request.CreateResponse(HttpStatusCode.OK, ToolInventoryRepo.GetToolCuttingMethods(ToolID, allMethods)));
     }
 }
 public HttpResponseMessage ConvertProgram([FromBody] ConvertProgramRequest convertProgramRequest)
 {
     using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
     {
         return(request.CreateResponse(HttpStatusCode.OK, ToolInventoryRepo.ConvertProgram(convertProgramRequest)));
     }
 }
 public HttpResponseMessage GetToolInventoryColumns(string code)
 {
     using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
     {
         return(request.CreateResponse(HttpStatusCode.OK, ToolInventoryRepo.GetToolInventoryColumns()));
     }
 }
 public HttpResponseMessage GetCuttingMethodsWithTemplate([FromQuery] ToolSetupSearchRequest toolSetupSearchRequest)
 {
     using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
     {
         return(request.CreateResponse(HttpStatusCode.OK, ToolInventoryRepo.GetCuttingMethodsWithTemplate(toolSetupSearchRequest.SearchTerm)));
     }
 }
 public HttpResponseMessage ToolInventorySearchSelected([FromBody] ToolInventorySearch toolInventorySearch)
 {
     using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
     {
         return(request.CreateResponse(HttpStatusCode.OK, ToolInventoryRepo.ToolInventorySearchSelected(toolInventorySearch)));
     }
 }
 public HttpResponseMessage GetLookUpCategory([FromBody] LookupCategorySearch lookupCategorySearch)
 {
     using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
     {
         return(request.CreateResponse(HttpStatusCode.OK, ToolInventoryRepo.GetLookUpCategory(lookupCategorySearch)));
     }
 }
 //public IActionResult GetByCategory([FromQuery]LookUpRequest lookUpRequest)
 public HttpResponseMessage GetByCategory([FromQuery] LookUpRequest lookUpRequest)
 {
     //return StatusCode(StatusCodes.Status200OK, ToolInventoryRepo.GetLookupByCategory(lookUpRequest.Category, lookUpRequest.SearchTerm));
     using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
     {
         return(request.CreateResponse(HttpStatusCode.OK, ToolInventoryRepo.GetLookupByCategory(lookUpRequest.Category, lookUpRequest.SearchTerm)));
     }
 }
 public HttpResponseMessage GetToolCategoryNames(string searchTerm = "")
 {
     using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
     {
         return(request.CreateResponse(HttpStatusCode.OK, ToolInventoryRepo.GetToolCategoryNames(searchTerm)));
     }
     //return StatusCode(StatusCodes.Status200OK, ToolInventoryRepo.GetToolCategoryNames());
 }
        public HttpResponseMessage GetMachines(string prefix = "")
        {
            List <string> retPartNumbers = ToolInventoryRepo.GetMachines(prefix);

            using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
            {
                return(request.CreateResponse(HttpStatusCode.OK, retPartNumbers.ToArray()));
            }
        }
        public HttpResponseMessage GetSetupSheets(string partnumber, string revision, string operation = "")
        {
            List <ToolSetupSheetHeader> setupSheetHeaders = ToolInventoryRepo.GetSetupSheets(partnumber, revision, operation);

            using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
            {
                return(request.CreateResponse(HttpStatusCode.OK, setupSheetHeaders));
            }
        }
        public HttpResponseMessage GetCuttingMethodTemplate(string cuttingMethod, string n)
        {
            List <string> retTemplate = ToolInventoryRepo.GetCuttingMethodTemplate(cuttingMethod, n);

            using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
            {
                return(request.CreateResponse(HttpStatusCode.OK, retTemplate.ToArray()));
            }
        }
        public HttpResponseMessage GetLookUpCategories(string searchTerm = "")
        {
            List <string> getCategories = ToolInventoryRepo.GetLookUpCategories(searchTerm);

            using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
            {
                return(request.CreateResponse(HttpStatusCode.OK, getCategories.ToArray()));
            }
        }
        public HttpResponseMessage GetSSPOperations(string partId, string operation = "")
        {
            List <string> retOperations = ToolInventoryRepo.GetSSPOperations(operation, partId);
            var           resultList    = retOperations.Where(x => x.IndexOf(operation, StringComparison.OrdinalIgnoreCase) > -1);

            using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
            {
                return(request.CreateResponse(HttpStatusCode.OK, resultList.ToArray()));
            }
        }
        public HttpResponseMessage GetTemplate(string cuttingMethod)
        {
            // URL can't handle period so use | instead
            cuttingMethod = cuttingMethod.Replace('|', '.');

            using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
            {
                return(request.CreateResponse(HttpStatusCode.OK, ToolInventoryRepo.GetCuttingMethodTemplate(cuttingMethod)));
            }
        }
        public HttpResponseMessage GetSSPPartNumbers(string materialType, string term)
        {
            List <string> retMaterialSize = ToolInventoryRepo.GetMaterialSize(term, materialType);
            var           resultList      = retMaterialSize.Where(x => x.IndexOf(term, StringComparison.OrdinalIgnoreCase) > -1);

            using (HttpRequestMessage request = HttpRequestMessageHttpContextExtensions.GetHttpRequestMessage(HttpContext))
            {
                return(request.CreateResponse(HttpStatusCode.OK, resultList.ToArray()));
            }
        }