public void Create(DalUserAnswer e)
        {
            if (e == null)
            {
                return;
            }
            var tmp = e.ToUserAnswer();

            context.Set <UserAnswer>().Add(tmp);
        }
        public void Update(DalUserAnswer entity)
        {
            var tmp = context.Set <UserAnswer>().SingleOrDefault(t => t.Id == entity.Id);

            if (tmp != null)
            {
                return;
            }
            tmp = entity.ToUserAnswer();
            context.Entry(tmp).State = EntityState.Modified;
        }
예제 #3
0
 public static UserAnswer ToUserAnswer(this DalUserAnswer userAnswer)
 {
     if (userAnswer == null)
     {
         return(null);
     }
     return(new UserAnswer()
     {
         //Id = userAnswer.Id,
         ResultId = userAnswer.ResultId,
         QuestionId = userAnswer.QuestionId,
         QuestionAnswerId = userAnswer.QuestionAnswerId
     });
 }