public async void Update(TestReport testReport) { if (testReport != null) { var existingReport = await TestReportRepository.GetOne(t => t.Id == testReport.Id); if (existingReport == null) { return; } testReport._id = existingReport._id; TestReportRepository.Update(t => t.Id == testReport.Id, testReport); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ViewState["CurrentQuestionNumber"] = 0; NextQuestionBtn.Text = "Start"; Test ts = Session["Test"] as Test; TestService testService = new TestService(_db); TestReportService testReportService = new TestReportService(); if (ts != null) { testReport = new TestReport(); testReport.AuthorId = ts.AuthorId; testReport.TestId = ts.Id; testReport.QuestionIds = testService.GetQuestionIds(ts); testReportService.Add(testReport); //testReportService.Add(new TestReport() { AuthorId = ts.AuthorId, TestId = ts.Id, QuestionIds = testService.GetQuestionIds(ts)}); } } }
public void Add(TestReport tr) { TestReportRepository.Insert(tr); }