public IHttpActionResult GetWeightTicketProducts(WeightTicketType type) { GetSelectableModelResponse response = new GetSelectableModelResponse(); try { List <SelectableModel> products = productBL.GetWeightTicketProducts(type); response.SelectableModels = products; response.Success = true; } catch (Exception ex) { response.ErrorMessage = "Error. " + ex.Message; response.Success = false; } return(Ok(response)); }
public List <SelectableModel> GetProductByProductGroupId(WeightTicketType type) { List <SelectableModel> products = new List <SelectableModel>(); using (SqlCommand command = new SqlCommand()) { using (SqlConnection connection = new SqlConnection()) { connection.ConnectionString = ConnectionString; command.Connection = connection; command.CommandText = "spGetWeightTicketProducts"; command.Parameters.Add("@WeightTicketType", SqlDbType.Int).Value = (int)type; command.CommandType = CommandType.StoredProcedure; connection.Open(); SqlDataReader reader = command.ExecuteReader(); products = DataReaderMapper.Map <SelectableModel>(reader); reader.Close(); connection.Close(); } return(products); } }
public List <SelectableModel> GetWeightTicketProducts(WeightTicketType type) { //Add validations here! return(productDL.GetProductByProductGroupId(type)); }