예제 #1
0
 public T saveUpdate(T entry)
 {
     try
     {
         using (var context = new DBBitzenContext())
         {
             context.Add(entry);
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         //generate log
     }
     return(entry);
 }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }