// Vraag 1 klant op //http://www.codeguru.com/csharp/.net/returning-images-from-asp.net-web-api.htm public Klant Get(int id) { try { string sql = "SELECT * FROM klanten WHERE id = @Id"; List <SqlParameter> parameters = new List <SqlParameter> { new SqlParameter("id", id) }; DataSet ds = dataProvider.Query(sql, parameters); return(DataRowToObject(ds.Tables[0].Rows[0])); } catch (Exception ex) { Debug.WriteLine(ex.Message + " | Line: " + new StackTrace(ex, true).GetFrame(0).GetFileLineNumber().ToString()); return(null); } }
/* Vraag foto ids voor fotoserie op */ public IEnumerable <int> GetAll(int fotoserieId) { List <int> fotoIds = new List <int>(); try { string sql = "SELECT id FROM fotos WHERE fotoserie_id = @FotoserieId"; SqlParameter parameter = new SqlParameter("FotoserieId", fotoserieId); DataSet ds = dataProvider.Query(sql, parameter); foreach (DataRow r in ds.Tables[0].Rows) { fotoIds.Add(Convert.ToInt32(r["id"])); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } return(fotoIds); }
public List <FotoProduct> GetAll() { List <FotoProduct> fotoproducten = new List <FotoProduct>(); try { string sql = "SELECT * FROM fotoproducten"; DataSet ds = dataProvider.Query(sql); foreach (DataRow r in ds.Tables[0].Rows) { fotoproducten.Add(DataRowToObject(r)); } } catch (Exception ex) { throw new Exception(ex.Message, ex); } return(fotoproducten); }
public IEnumerable <Fotoserie> GetAll() { List <Fotoserie> fotoseries = new List <Fotoserie>(); try { string sql = "SELECT * FROM fotoseries"; DataSet ds = dataProvider.Query(sql); foreach (DataRow r in ds.Tables[0].Rows) { fotoseries.Add(DataRowToObject(r)); } } catch (Exception ex) { throw new Exception(ex.Message, ex); } return(fotoseries); }