public product GetProductByOrderCode(string code) { product entity = new product(); using (chargepointEntities dbContext = new chargepointEntities()) { try { entity = dbContext.products.FirstOrDefault(row => row.order_code == code); } catch (Exception) { string.Format("unable to retrieve products by order code: {0}", code); } } return(entity); }
public List <product> GetProductsByTypeId(Int32 id) { var list = new List <product>(); using (chargepointEntities dbContext = new chargepointEntities()) { try { var query = from p in dbContext.products where p.product_type_id == id select p; list = query.ToList(); } catch (Exception) { string.Format("unable to retrieve products by type id: {0}", id); } } return(list); }