コード例 #1
0
        public ActionResult Create(Waiting waiting)
        {
            if (ModelState.IsValid)
            {
                db.Waitings.Add(waiting);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(waiting);
        }
コード例 #2
0
 // GET: Waitings/Create
 public ActionResult Create(int WorkshopID, string WorkshopName, int WorkshopSetID)
 {
     Waiting waiting0 = db.Waitings.Where(x => x.studentID.ToString() == User.Identity.Name.ToString().Substring(0, 8)
         && x.workshopID == WorkshopID).FirstOrDefault();
     if (waiting0 == null)
     {
         ViewBag.getCount = db.Waitings.Where(x => x.workshopID == WorkshopID).Count();
         Waiting data = new Waiting();
         data.createdtime = DateTime.Today;
         data.workshopID = WorkshopID;
         data.workshopName = WorkshopName;
         data.workshopSetID = WorkshopSetID;
         data.studentID = int.Parse(User.Identity.Name.Substring(0, 8));
         return View(data);
     }
     else
     {
         return RedirectToAction("Edit", "Waitings", new { @id = waiting0.ID });
     }
 }
コード例 #3
0
 public ActionResult Edit(Waiting waiting)
 {
     if (ModelState.IsValid)
     {
         db.Entry(waiting).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(waiting);
 }