コード例 #1
0
        public ActionResult DeleteConfirmed(long id)
        {
            workoutplanentry workoutplanentry = db.workoutplanentries.Find(id);

            db.workoutplanentries.Remove(workoutplanentry);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "wpe_id,wpe_w_workout,wpe_creationdate,wpe_scheduledate,wpe_repeat,wpe_u_user")] workoutplanentry workoutplanentry)
 {
     if (ModelState.IsValid)
     {
         db.Entry(workoutplanentry).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.wpe_u_user    = new SelectList(db.users, "u_name", "u_password", workoutplanentry.wpe_u_user);
     ViewBag.wpe_w_workout = new SelectList(db.workouts, "w_id", "w_name", workoutplanentry.wpe_w_workout);
     return(View(workoutplanentry));
 }
コード例 #3
0
        // GET: workoutplanentry/Details/5
        // not sure if this works
        public ActionResult Details(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            workoutplanentry workoutplanentry = db.workoutplanentries.Find(id);

            if (workoutplanentry == null)
            {
                return(HttpNotFound());
            }
            return(View(workoutplanentry));
        }
コード例 #4
0
        // GET: workoutplanentry/Edit/5
        public ActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            workoutplanentry workoutplanentry = db.workoutplanentries.Find(id);

            if (workoutplanentry == null)
            {
                return(HttpNotFound());
            }
            ViewBag.wpe_u_user    = new SelectList(db.users, "u_name", "u_password", workoutplanentry.wpe_u_user);
            ViewBag.wpe_w_workout = new SelectList(db.workouts, "w_id", "w_name", workoutplanentry.wpe_w_workout);
            return(View(workoutplanentry));
        }
コード例 #5
0
        public ActionResult Create([Bind(Include = "wpe_id,wpe_w_workout,wpe_creationdate,wpe_scheduledate,wpe_repeat,wpe_u_user")] workoutplanentry workoutplanentry)
        {
            if (ModelState.IsValid)
            {
                workoutplanentry.wpe_creationdate = DateTime.Today;
                workoutplanentry.wpe_u_user       = User.Identity.Name;

                db.workoutplanentries.Add(workoutplanentry);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.wpe_u_user    = new SelectList(db.users, "u_name", "u_password", workoutplanentry.wpe_u_user);
            ViewBag.wpe_w_workout = new SelectList(db.workouts, "w_id", "w_name", workoutplanentry.wpe_w_workout);
            return(View(workoutplanentry));
        }