Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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());
        }