示例#1
0
        public void QuestionAdd(Question question)
        {
            if (question.Id == 0)
            {
                context.Questions.Add(question);
                context.SaveChanges();
            } else
            {
                var q = context.Questions.SingleOrDefault(x => x.Id == question.Id);
                q.Description = question.Description;
                q.PublishedAt = question.PublishedAt;
                context.SaveChanges();

            }
        }
示例#2
0
 public void QuestionDelete(Question question)
 {
     context.Questions.Remove(question);
     context.SaveChanges();
 }
示例#3
0
 public QuestionAddViewModel()
 {
     Question = new Question();
 }