public ActionResult AddResult(FixtureModel FixtureObj) { AddResultViewModel rvm = new AddResultViewModel(); rvm.Details = FixtureObj; if (FixtureObj.FixtureType == 0) { rvm.FixtureTypeList = resRepo.LeagueResult_GetFixtureTypes(); } var players = resRepo.LeagueResult_GetTeamsForFixture(FixtureObj.FixtureRef); rvm.HomePlayers = new List <PlayerModel>(); rvm.AwayPlayers = new List <PlayerModel>(); foreach (var p in players) { PlayerModel play = new PlayerModel(); play.Id = p.PlayerRef; play.RegistrationId = p.RegistrationId; play.Name = p.Forename.Substring(0, 1) + " " + p.Surname; if (p.TeamRef == FixtureObj.HomeTeamRef) { rvm.HomePlayers.Add(play); } else { rvm.AwayPlayers.Add(play); } } return(PartialView("Partial_AddResult", rvm)); }
public ActionResult AddResult() { var viewModel = new AddResultViewModel(); var matches = this.matchService.GetAllOpen(); var result = new List <ViewTeam>(); foreach (var match in matches) { string homeTeam = this.teamService.FindTeamNameById(match.HomeTeam); string awayTeam = this.teamService.FindTeamNameById(match.AwayTeam); result.Add(new ViewTeam() { Id = match.Id, homeTeam = homeTeam, awayTeam = awayTeam, homeGoals = 0, awayGoals = 0 }); } viewModel.Matches = result; return(this.View(viewModel)); }
public async Task <IActionResult> OnGetAsync(Guid?matchId) { var matchEntity = await GetMatchById(matchId); ResultModel = new AddResultViewModel(matchEntity); return(Page()); }
public static AddResultViewModel AddResult(Fixture fixture) { AddResultViewModel rvm = new AddResultViewModel(); rvm.Details = fixture; if (fixture.FixtureType == 0) { rvm.FixtureTypeList = _Repository.LeagueResult_GetFixtureTypes(); } List <LeagueResult_TeamsForFixture_Result> players = _Repository.LeagueResult_GetTeamsForFixture(fixture.FixtureRef); rvm.HomePlayers = new List <Player>(); rvm.AwayPlayers = new List <Player>(); foreach (LeagueResult_TeamsForFixture_Result p in players) { Player play = new Player(); play.Id = p.PlayerRef; play.RegistrationId = p.RegistrationId; play.Name = p.Forename.Substring(0, 1) + " " + p.Surname; if (p.TeamRef == fixture.HomeTeamRef) { rvm.HomePlayers.Add(play); } else { rvm.AwayPlayers.Add(play); } } return(rvm); }
public async Task <IActionResult> SaveResult(AddResultViewModel model) { var participant = await _participantsRepository.GetAsync(model.ProjectId, model.ParticipantId); var result = await _resultRepository.GetAsync(model.ProjectId, model.ParticipantId); model.ParticipantFullName = participant.FullName; if (result == null) { model.Score = 0; model.Submitted = DateTime.UtcNow; await _resultRepository.SaveAsync(model); participant.Result = true; await _participantsRepository.UpdateAsync(participant); } else { model.Score = result.Score; model.Submitted = result.Submitted; model.Votes = result.Votes; await _resultRepository.UpdateAsync(model); } return(RedirectToAction("ProjectDetails", "Project", new { id = model.ProjectId })); }
public ActionResult AddResult(string id) { var result = new AddResultViewModel() { Patient = this.Data.Users.GetById(id) }; return(View(result)); }
public IActionResult AddResult(string id) { var viewModel = new AddResultViewModel { ProjectId = id, ParticipantId = GetAuthenticatedUser().Email }; return(View("~/Views/Project/AddResult.cshtml", viewModel)); }
public ActionResult ShowData(AddResultViewModel addResultViewModel) { //for checking report with this id exist or not var report = _context.Reports .Include(t => t.Patient) .Include(t => t.TestTitle) .Include(t => t.ConsultingPathologist) .Include(t => t.Doctor) .Single(r => r.Id == addResultViewModel.Report.Id); var resultValues = addResultViewModel.Results; var testIds = addResultViewModel.TestIds; var reportId = addResultViewModel.Report.Id; var i = 0; var results = new List <Result>(); foreach (var item in resultValues) { if (item == null || item == "") { i++; continue; } var newResult = new Result(); newResult.testId = testIds[i]; newResult.value = resultValues[i]; newResult.ReportId = addResultViewModel.Report.Id; _context.Result.Add(newResult); var reportInDb = _context.Reports.Single(r => r.Id == reportId); reportInDb.isInvestgationDone = true; _context.SaveChanges(); results.Add(newResult); i++; } //for showing report //var subtests = _context.SubtestTitles.Where(s => s.TestTitleId == report.TestTitleId).ToList(); //var tests = new List<Test>(); //foreach (var testId in testIds) //{ // var test = _context.Tests.Single(t => t.Id == testId); // tests.Add(test); //} //var showReportViewModel = new ShowReportViewModel { Report = report, // Tests =tests , // SubtestTitles =subtests, // Results= results}; return(null); }
public IActionResult AddResult(string id) { var user = UserModel.GetAuthenticatedUser(User.Identity); var viewModel = new AddResultViewModel { ProjectId = id, ParticipantId = user.Email, ParticipantIdentifier = user.Id }; return(View("~/Views/Project/AddResult.cshtml", viewModel)); }
public async Task <IActionResult> EditResult(EditResultViewModel model) { var result = await _resultRepository.GetAsync(model.ProjectId, model.UserId); var viewModel = new AddResultViewModel { ProjectId = model.ProjectId, ParticipantId = model.UserId, Link = result.Link }; return(View("~/Views/Project/AddResult.cshtml", viewModel)); }
public PDF GetPDF(AddResultViewModel result) { var file = new PDF(); if (result.UploadedFile != null) { file.FileName = result.UploadedFile.FileName; using (var memory = new MemoryStream()) { result.UploadedFile.InputStream.CopyTo(memory); var content = memory.GetBuffer(); file.Content = content; } } return(file); }
public ActionResult AddResult(int Id) { var report = _context.Reports .Include(t => t.TestTitle) .Include(t => t.Patient) .Include(t => t.Doctor) .SingleOrDefault(t => t.Id == Id); if (report == null) { return(HttpNotFound("Test Title Id")); } if (report.isInvestgationDone == true) { return(View("PendingReport")); } var testTitle = report.TestTitle; var subtestTitles = _context.SubtestTitles.Where(t => t.TestTitleId == testTitle.Id).ToList(); var tests = new List <Test>(); foreach (var subtestTitle in subtestTitles) { var newTest = _context.Tests.Where(t => t.SubtestTitleId == subtestTitle.Id).ToList(); tests.AddRange(newTest); } var testTitles = new List <int>(); var patient = report.Patient; var addResultViewModel = new AddResultViewModel { SubtestTitles = subtestTitles, TestTitle = testTitle, Tests = tests, Patient = patient, Report = report }; return(View(addResultViewModel)); }
public async Task <IActionResult> SaveResult(AddResultViewModel model) { var participant = await _participantsRepository.GetAsync(model.ProjectId, model.ParticipantId); if (participant == null) { return(View("AccessDenied")); } var result = await _resultRepository.GetAsync(model.ProjectId, model.ParticipantId); model.ParticipantFullName = participant.FullName; model.UserAgent = HttpContext.Request.Headers["User-Agent"].ToString(); if (result == null) { model.Score = 0; model.Submitted = DateTime.UtcNow; await _resultRepository.SaveAsync(model); participant.Result = true; await _participantsRepository.UpdateAsync(participant); var project = await _projectRepository.GetAsync(model.ProjectId); project.LastModified = DateTime.UtcNow; await _projectRepository.UpdateAsync(project); } else { model.Score = result.Score; model.Submitted = result.Submitted; model.Votes = result.Votes; await _resultRepository.UpdateAsync(model); } return(RedirectToAction("ProjectDetails", "Project", new { id = model.ProjectId })); }
public ActionResult AddResult(AddResultViewModel result) { if (ModelState.IsValid) { var patient = this.Data.Users.GetById(result.PatientId); var clinRes = new ClinicalResult() { StatusResult = result.StatusResult, File = this.adminService.GetPDF(result), }; patient.ClinicalResults.Add(clinRes); this.Data.SaveChanges(); return(RedirectToAction("Patients")); } return(View(result)); }