Exemple #1
0
 public static Question FromDbModel(QuestionDbModel model)
 {
     return(new Question
     {
         Id = model.Id,
         TestId = model.TestId,
         Text = model.Text,
     });
 }
Exemple #2
0
        public void QuestionDelete(QuestionDbModel item)
        {
            var model = questions.FirstOrDefault(i => i.Id == item.Id);

            if (model != null)
            {
                Entry(model).State = EntityState.Detached;
                Entry(item).State  = EntityState.Deleted;
            }
        }
Exemple #3
0
        public void QuestionInsert(QuestionDbModel item)
        {
            var model = questions.FirstOrDefault(i => i.Id == item.Id);

            if (model != null)
            {
                Entry(model).State = EntityState.Detached;
                Entry(item).State  = EntityState.Modified;
            }
            else
            {
                questions.Add(item);
            }
            SaveChanges();
        }