Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 //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 });
     }
 }
Ejemplo n.º 3
0
 public ActionResult Edit(Attendance attendance)
 {
     if (ModelState.IsValid)
     {
         db.Entry(attendance).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(attendance);
 }