///<summary> ///Atualiza questionário /// </summary> public void delete(int id) { try { QuestionAnswerRepository repository = new QuestionAnswerRepository(); repository.delete(x => x.Id == id); } catch (Exception e) { throw e; } }
public List <QuestionAnswersEntity> GetByQuestion(int questionId) { try { QuestionAnswerRepository repository = new QuestionAnswerRepository(); return(repository.Get(x => x.IdQuestion == questionId).ToList()); } catch (Exception e) { throw e; } }
public UnitOfWork(CuriousDriveContext context) { _context = context; Roles = new RoleRepository(_context); Messages = new MessageRepository(_context); Users = new UserRepository(_context); Questions = new QuestionRepository(_context); Classes = new ClassRepository(_context); QuestionAnswers = new QuestionAnswerRepository(_context); QuestionClasses = new QuestionClassRepository(_context); Comments = new CommentRepository(_context); Tags = new TagRepository(_context); TagDetails = new TagDetailRepository(_context); Feedback = new FeedbackRepository(_context); }
private async void SubmitSurvey() { var answers = new List <SurveyAnswer>(); if (UserAnswers.Count > 0 && !string.IsNullOrEmpty(UserId)) { //Submit UserSurvey var userSurvey = await AccountSurveyRepository.AddAccountSurvey(new AccountSurvey { Id = UserId, SurveyId = Survey.SurveyId, Risk = UserAnswers.Sum(p => p.Percentage), SurveyDate = DateTime.Now, UserSurveyStatus = SurveyResult(UserAnswers.Sum(p => p.Percentage)) }); if (userSurvey != null) { foreach (var userAnswer in UserAnswers) { answers.Add(new SurveyAnswer { AccountSurveyId = userSurvey.AccountSurveyId, Answer = userAnswer.UserAnswer, Question = userAnswer.Question.SurveyQuestion }); } var added = await QuestionAnswerRepository.AddRange(answers); if (added) { Open = false; StateHasChanged(); await SweetAlertMessage.SuccessMessage(); //Navigate to show results } else { await SweetAlertMessage.ErrorMessage(); } } } else { await SweetAlertMessage.ErrorMessage(Text : "Survey not completed, please answer atleast one question"); } }
public UnitOfWork(LogDbContext dbContext) { _dbContext = dbContext; Classes = new SchoolClassRepository(dbContext); Users = new UserRepository(dbContext); Students = new StudentRepository(dbContext); Teachers = new TeacherRepository(dbContext); Parents = new ParentRepository(dbContext); Subjects = new SubjectRepository(dbContext); SchoolGrades = new SchoolGradeRepository(dbContext); Messages = new MessageRepository(dbContext); Advertisements = new AdvertisementRepository(dbContext); Files = new FileRepository(dbContext); Questions = new QuestionRepository(dbContext); QuestionAnswers = new QuestionAnswerRepository(dbContext); Tests = new TestRepository(dbContext); }
protected void imgSurvey_clicked(object sender, System.EventArgs e) { QuestionAnswerRepository repos = new QuestionAnswerRepository(); bool isReadOnly = false; int? screenNum = repos.GetLastScreenInSurvey(UserHelper.GetLoggedInUser(Session).UserID); if (!screenNum.HasValue) { screenNum = 1; } if (screenNum == 4) { isReadOnly = true; screenNum = 1; } Response.Redirect( string.Format("~/Physician/AssesSurvey.aspx?screenID={0}&{1}={2}", screenNum.ToString(), Constants.READONLY, UserHelper.GetLoggedInUser(HttpContext.Current.Session).AssesmentSurvey.HasValue ? isReadOnly ? "1" : "0" : "0") ); }
///<summary> ///Atualiza questionário /// </summary> public QuestionAnswersEntity GetById(int id) { QuestionAnswerRepository repository = new QuestionAnswerRepository(); return(repository.GetById(id)); }
///<summary> ///Atualiza questionário /// </summary> public void Update(QuestionAnswersEntity entity) { QuestionAnswerRepository repository = new QuestionAnswerRepository(); repository.update(entity); }
public void Create(QuestionAnswersEntity entity) { QuestionAnswerRepository repository = new QuestionAnswerRepository(); repository.save(entity); }
public FAQController() { _faqRepository = new FaqRepository(); _questionAnswerRepository = new QuestionAnswerRepository(); _routeItemRepository = new RouteItemRepository(); }