示例#1
0
        public async Task <IActionResult> AthletesList([FromForm] AthletesViewModel athletesViewModel)
        {
            var             users           = _dbContext.User.Where(s => s.Name == athletesViewModel.AName);
            UserTestMapping userTestMapping = new UserTestMapping();
            TestDetails     testDetails     = new TestDetails();
            TestTypeMapping typeMapping     = new TestTypeMapping();

            typeMapping.TestId = testDetails.ID;
            _dbContext.UserTestMapping.Add(userTestMapping);
            await _dbContext.SaveChangesAsync();

            return(RedirectToAction("TestAthleteDetails", new { id = testId }));
        }
示例#2
0
        public async Task <IActionResult> CreateNewTest([FromForm] CreateTestViewModel createTestView)
        {
            TestDetails     testDetails = new TestDetails();
            TestTypeMapping typeMapping = new TestTypeMapping();
            var             Map         = _dbContext.TestType.Where(s => s.TestName == createTestView.TestType).FirstOrDefault();

            testDetails.Date = createTestView.TestDate;
            _dbContext.TestDetails.Add(testDetails);

            typeMapping.TestId     = testDetails.ID;
            typeMapping.TestTypeId = Map.ID;
            _dbContext.TestTypeMapping.Add(typeMapping);
            await _dbContext.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }