Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("TesterId,TesterName")] Tester tester)
        {
            if (ModelState.IsValid)
            {
                if (TesterExists(tester.TesterId))
                {
                    return(Content("Tester Id already exists.Please use company id number."));
                }
                _context.Add(tester);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tester));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("TestId,TestTitle,Functionality,TesterId")] Test test)
        {
            if (ModelState.IsValid)
            {
                if (TestExists(test.TestId))
                {
                    return(Content("This test Id already exists. Check Id from Requirements of Your Company database."));
                }
                if (!TesterExists(test.TesterId.ToString()))
                {
                    return(Content("The tester Id for this test does not exist .Return and retry."));
                }


                _context.Add(test);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(test));
        }