public async Task <IActionResult> Create([Bind("id,ActivePool,DrugPercentage,DrugTestDate,AlcoholPercentage,AlcoholTestDate")] CreateBatch createBatch) { if (ModelState.IsValid) { _context.Add(createBatch); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(createBatch)); }
public async Task <IActionResult> Create([Bind("Id,Batch_Id,Selectiondatedrug,Selectiondatealcohol,Reported_Results,ResultsDate,SSN,Specimen_Id,ClosedDate,Test_Process_Id,Driver_Id,Test_Type,Drug_Percentage,Alcohol_Percentage,Created,Modified,Status,isDelete")] TestingLog testingLog) { if (ModelState.IsValid) { _context.Add(testingLog); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(testingLog)); }
public async Task <IActionResult> Create( [Bind("Company_id,DriverName,SSN,AddressLine1,AddressLine2,City,State,Zipcode,Location,Phone,Fax,Cell,Email,CDL")] Driver driver) { using RDATContext context = new RDATContext(); var drivers = context.Drivers; try { if (ModelState.IsValid) { driver.UniqueId = Guid.NewGuid(); driver.EnrollmentDate = DateTime.Now; drivers.Add(driver); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } } catch (DbUpdateException /* ex */) { //Log the error (uncomment ex variable name and write a log. ModelState.AddModelError("", "Unable to save changes. " + "Try again, and if the problem persists " + "see your system administrator."); } return(View()); }