public IActionResult create(batchViewModel model)
 {
     if (ModelState.IsValid)
     {
         Batch batch = new Batch()
         {
             Name       = model.BatchName,
             Supervisor = model.Title.ToString() + ". " + model.FirstName + " " + model.LastName,
             StartDate  = model.startDate,
             EndDate    = model.endDate
         };
         _batchRepo.AddBatch(batch);
     }
     return(RedirectToAction("Index"));
 }
Exemple #2
0
 public IActionResult create(batchViewModel model)
 {
     if (ModelState.IsValid)
     {
         Batch batch = new Batch()
         {
             Name       = model.BatchName,
             Supervisor = model.Title.ToString() + ". " + model.FirstName + " " + model.LastName,
             StartDate  = model.startDate.Date,
             EndDate    = model.endDate.Date,
             Year       = model.startDate.Year.ToString(),
             Program_Id = int.Parse(model.selectedProgram),
             //programme = model.programName.ToString(),
         };
         _batchRepo.AddBatch(batch);
     }
     return(RedirectToAction("Index"));
 }