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(); } }
public void QuestionDelete(Question question) { context.Questions.Remove(question); context.SaveChanges(); }
public QuestionAddViewModel() { Question = new Question(); }