public async Task <IActionResult> Create([Bind("BatchId,BatchVersion,TestId,TestVersion,Passed")] BatchTest batchTest) { if (ModelState.IsValid) { _context.Add(batchTest); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BatchId"] = new SelectList(_context.Batch, "BatchId", "Status", batchTest.BatchId); ViewData["TestId"] = new SelectList(_context.Test, "TestId", "TestId", batchTest.TestId); return(View(batchTest)); }
public async Task <IActionResult> Create([Bind("TestId,TestVersion,UserId,EcuId,Name,DateRun")] Test test) { if (ModelState.IsValid) { test.DateCreated = DateTime.Now; _context.Add(test); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EcuId"] = new SelectList(_context.Ecu, "EcuId", "EcuModel", test.EcuId); ViewData["UserId"] = new SelectList(_context.User, "UserId", "Email", test.UserId); return(View(test)); }
public async Task <IActionResult> Create([Bind("BatchId,BatchVersion,AuthorUserId,TesterUserId,SimId,Name,Status,DateCreated,DateRun,Display")] Batch batch) { if (ModelState.IsValid) { _context.Add(batch); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AuthorUserId"] = new SelectList(_context.User, "UserId", "Email", batch.AuthorUserId); ViewData["SimId"] = new SelectList(_context.Simulator, "SimId", "SimId", batch.SimId); ViewData["TesterUserId"] = new SelectList(_context.User, "UserId", "Email", batch.TesterUserId); return(View(batch)); }
public async Task <IActionResult> CreateConfirmed([Bind("BatchId,BatchVersion,AuthorUserId,TesterUserId,SimId,Name,Status,DateCreated,DateRun,Display")] Batch batch) { batch.Status = "Made"; batch.DateCreated = DateTime.Now; batch.Display = 1; batch.TesterUserId = null; if (ModelState.IsValid) { _context.Add(batch); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Edit), new { id = batch.BatchId, version = batch.BatchVersion })); } ViewData["AuthorUserId"] = new SelectList(_context.User, "UserId", "Email", batch.AuthorUserId); ViewData["SimId"] = new SelectList(_context.Simulator, "SimId", "SimId", batch.SimId); ViewData["TesterUserId"] = new SelectList(_context.User, "UserId", "Email", batch.TesterUserId); return(RedirectToAction(nameof(Create))); }
public async Task <IActionResult> Create([Bind("UserId,FirstName,LastName,Password,Email,Privilege")] User user) { if (ModelState.IsValid) { _context.Add(user); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(user)); }
public async Task <IActionResult> Create([Bind("BatchId,BatchVersion,TestId,TestVersion,ProcId,ReqId,Parameters,Passed,Order")] TestProc testProc) { if (ModelState.IsValid) { _context.Add(testProc); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BatchId"] = new SelectList(_context.Batch, "BatchId", "Status", testProc.BatchId); ViewData["ProcId"] = new SelectList(_context.Procedure, "ProcId", "Description", testProc.ProcId); ViewData["ReqId"] = new SelectList(_context.Requirement, "ReqId", "Description", testProc.ReqId); ViewData["TestId"] = new SelectList(_context.Test, "TestId", "TestId", testProc.TestId); return(View(testProc)); }
public async Task <IActionResult> Create([Bind("FirstName,LastName,Password,Email")] User user, bool Privilege = false) { if (ModelState.IsValid) { if (Privilege) { user.Privilege = "Admin"; } else { user.Privilege = "User"; } _context.Add(user); await _context.SaveChangesAsync(); return(View("~/Views/Home/Index.cshtml")); } return(View("Index")); }