コード例 #1
0
        public KeyValuePair <string, string> GetQuestionAnswer()
        {
            using (var context = new MVCDBEntities())
            {
                Random rand   = new Random();
                int    toSkip = rand.Next(0, context.QnAs.Count <QnA>());

                var myQnA    = context.QnAs.OrderBy(q => q.QnAId).Skip(toSkip).Take(1).First();
                var question = myQnA.Question;
                var answer   = myQnA.Answer;
                return(new KeyValuePair <string, string>(question, answer));
            }
        }
コード例 #2
0
 public AuthorRepository(MVCDBEntities AuthorContext)
 {
     _Context = AuthorContext;
 }
コード例 #3
0
 public BookRepository(MVCDBEntities bookContext)
 {
     this._context = bookContext;
 }