/// <summary> /// Get Product /// </summary> /// <param name="accountId"></param> /// <param name="productNumber"></param> /// <returns></returns> public async Task <ResponseModel <ProductDataTransformation> > GetProduct(int accountId, string productNumber) { ResponseModel <ProductDataTransformation> returnResponse = new ResponseModel <ProductDataTransformation>(); ProductDataTransformation productDataTransformation = new ProductDataTransformation(); try { _purchaseOrderManagementDataService.OpenConnection(_connectionStrings.PrimaryDatabaseConnectionString); Product product = await _purchaseOrderManagementDataService.GetProduct(accountId, productNumber); if (product == null) { returnResponse.ReturnStatus = false; returnResponse.ReturnMessage.Add("Product Number not found."); } else { productDataTransformation.AccountId = product.AccountId; productDataTransformation.ProductId = product.ProductId; productDataTransformation.ProductMasterId = product.ProductMasterId; productDataTransformation.ProductNumber = product.ProductNumber; productDataTransformation.Description = product.Description; returnResponse.ReturnStatus = true; } } catch (Exception ex) { returnResponse.ReturnStatus = false; returnResponse.ReturnMessage.Add(ex.Message); } finally { _purchaseOrderManagementDataService.CloseConnection(); } returnResponse.Entity = productDataTransformation; return(returnResponse); }