public static UsersAnswersEntity ToBllUsersAnswers(this DalUsersAnswers e)
 {
     return(new UsersAnswersEntity()
     {
         QuestionId = e.QuestionId,
         AnswerStructure = e.AnswerStructure,
         BeginningTime = e.BeginningTime,
         EndingTime = e.EndingTime,
         UserTestId = e.UserTestId
     });
 }
示例#2
0
        public void Delete(DalUsersAnswers e)
        {
            if (context.Database.Connection.State != ConnectionState.Open)
            {
                context.Database.Connection.Open();
            }
            UsersAnswers ua = context.Set <UsersAnswers>().
                              FirstOrDefault(a => a.UsersTestId == e.UserTestId &&
                                             a.QuestionId == e.QuestionId &&
                                             a.BeginningTime == e.BeginningTime);

            context.Set <UsersAnswers>().Remove(ua);
        }
示例#3
0
        public void Update(DalUsersAnswers entity)
        {
            if (context.Database.Connection.State != ConnectionState.Open)
            {
                context.Database.Connection.Open();
            }
            UsersAnswers ua = context.Set <UsersAnswers>().
                              FirstOrDefault(a => a.UsersTestId == entity.UserTestId &&
                                             a.QuestionId == entity.QuestionId &&
                                             a.BeginningTime == entity.BeginningTime);

            ua.AnswerStructure = entity.AnswerStructure;
            ua.EndingTime      = entity.EndingTime;
        }
示例#4
0
        public void Create(DalUsersAnswers e)
        {
            if (context.Database.Connection.State != ConnectionState.Open)
            {
                context.Database.Connection.Open();
            }
            UsersAnswers ua = new UsersAnswers()
            {
                AnswerStructure = e.AnswerStructure,
                BeginningTime   = e.BeginningTime,
                EndingTime      = e.EndingTime,
                QuestionId      = e.QuestionId,
                UsersTestId     = e.UserTestId
            };

            context.Set <UsersAnswers>().Add(ua);
        }