public ActionResult Create2(int workshopID, int bookingID, string workshopName)
 {
     Attendance attendence = new Attendance();
     attendence.studentID = int.Parse(User.Identity.Name.Substring(0, 8));
     attendence.workshopName = workshopName;
     attendence.createdtime = DateTime.Today;
     attendence.attendancetime = DateTime.Now;
     attendence.bookingID = bookingID;
     attendence.workshopID = workshopID;
     return View("Create",attendence);
 }
 //route Create/workshopID/bookingID/workshopName
 //[Route(new(workshopID=1, "bookingID", "workshopName",)]
 public ActionResult Create(int workshopID, int bookingID, string workshopName)
 {
     Attendance attendence0 = db.Attendence.Where(x => x.bookingID == bookingID
         && x.workshopID == workshopID).FirstOrDefault();
     if (attendence0 == null)
     {
         Attendance attendence = new Attendance();
         attendence.studentID = int.Parse(User.Identity.Name.Substring(0, 8));
         attendence.workshopName = workshopName;
         attendence.createdtime = DateTime.Today;
         attendence.attendancetime = DateTime.Now;
         attendence.bookingID = bookingID;
         attendence.workshopID = workshopID;
         return View(attendence);
     }
     else
     {
         return RedirectToAction("Edit", "Attendances", new { @id = attendence0.ID });
     }
 }
 public ActionResult Edit(Attendance attendance)
 {
     if (ModelState.IsValid)
     {
         db.Entry(attendance).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(attendance);
 }