Exemplo n.º 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();

            }
        }
Exemplo n.º 2
0
 public void QuestionDelete(Question question)
 {
     context.Questions.Remove(question);
     context.SaveChanges();
 }
Exemplo n.º 3
0
 public QuestionAddViewModel()
 {
     Question = new Question();
 }