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 }); }
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); }
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; }
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); }