コード例 #1
0
        public void RemoveStudent(int Id)
        {
            using (var cassandraDA = new CassandraDA(_config))
            {
                var     session = cassandraDA.GetSession();
                IMapper mapper  = new Mapper(session);

                mapper.Execute("Delete From tblStudent Where Id = ?", Id);
            }
        }
コード例 #2
0
        public void ChangeDetails(Student student)
        {
            using (var cassandraDA = new CassandraDA(_config))
            {
                var     session = cassandraDA.GetSession();
                IMapper mapper  = new Mapper(session);

                mapper.Execute(" Update tblStudent SET Name = ?, Email = ?, Phone = ? where Id = ?;", student.Name, student.Email, student.Phone, student.Id);
            }
        }
コード例 #3
0
        public Student GetStudentById(int Id)
        {
            using (var cassandraDA = new CassandraDA(_config))
            {
                var     session = cassandraDA.GetSession();
                IMapper mapper  = new Mapper(session);

                var student = mapper.SingleOrDefault <Student>("Select * From tblStudent Where Id = ?;", Id);
                return(student);
            }
        }
コード例 #4
0
        public void NewStudent(Student student)
        {
            using (var cassandraDA = new CassandraDA(_config))
            {
                var     session = cassandraDA.GetSession();
                IMapper mapper  = new Mapper(session);


                mapper.Execute("Insert into tblstudent(Id, Name, Email, Phone) Values(?,?,?,?)", student.Id, student.Name, student.Email, student.Phone);
            }
        }
コード例 #5
0
        public IEnumerable <Student> GetStudents()
        {
            using (var cassandraDA = new CassandraDA(_config))
            {
                var     session = cassandraDA.GetSession();
                IMapper mapper  = new Mapper(session);

                var students = mapper.Fetch <Student>("Select * From tblStudent;");
                return(students);
            }
        }