public T saveUpdate(T entry) { try { using (var context = new DBBitzenContext()) { context.Add(entry); context.SaveChanges(); } } catch (Exception ex) { //generate log } return(entry); }
public List <Login> findAll() { List <Login> result = new List <Login>(); try { using (var context = new DBBitzenContext()) { result = context.Login.ToList(); } } catch (Exception ex) { //generate log } return(result); }
public List <Login> find(int id) { List <Login> result = new List <Login>(); try { using (var context = new DBBitzenContext()) { result = context.Login.Where(w => w.id == id).ToList(); } } catch (Exception ex) { //generate log } return(result); }
public List <Vehicle> find(Vehicle entry) { List <Vehicle> result = new List <Vehicle>(); try { using (var context = new DBBitzenContext()) { result = context.Vehicle.Where(w => w == entry).ToList(); } } catch (Exception ex) { //generate log } return(result); }
public List <Login> find(Login entry) { List <Login> result = new List <Login>(); try { using (var context = new DBBitzenContext()) { result = context.Login.Where(w => w.email == entry.email && w.password == entry.password ).ToList(); } } catch (Exception ex) { //generate log } return(result); }
public bool delete(T entry) { bool result = true; try { using (var context = new DBBitzenContext()) { context.Remove(entry); context.SaveChanges(); } } catch (Exception) { result = false; } return(result); }
public void ContextTest() { String message = String.Empty; bool status = false; try { //try connect database: using (var context = new DBBitzenContext()) { //execute a basic query var result = context.Supply.ToList(); } status = true; }catch (Exception ex) { message = ex.Message; } Assert.IsTrue(status, message); }