Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            BaseballCard baseballCard = db.BaseballCard.Find(id);

            db.BaseballCard.Remove(baseballCard);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BaseballCard baseballCard = db.BaseballCard.Find(id);

            if (baseballCard == null)
            {
                return(HttpNotFound());
            }
            return(View(baseballCard));
        }
Ejemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "BaseballCardID,CardNumber,TeamID,PlayerID,CoachID,PlayerNumber,PositionID,ManufacturerID,CardYear")] BaseballCard baseballCard)
 {
     if (ModelState.IsValid)
     {
         db.Entry(baseballCard).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ManufacturerID = new SelectList(db.ManufacturerInfo, "ManufacturerID", "ManufacturerName", baseballCard.ManufacturerID);
     ViewBag.PlayerID       = new SelectList(db.Player, "PlayerID", "PlayerName", baseballCard.PlayerID);
     ViewBag.CoachID        = new SelectList(db.Coach, "CoachID", "CoachName", baseballCard.CoachID);
     ViewBag.TeamID         = new SelectList(db.Team, "TeamID", "TeamName", baseballCard.TeamID);
     ViewBag.PositionID     = new SelectList(db.Position, "PositionID", "PositionName", baseballCard.PositionID);
     return(View(baseballCard));
 }
        public ActionResult Create([Bind(Include = "BaseballCardID,CardNumber,TeamID,PlayerID,CoachID,PlayerNumber,PositionID,ManufacturerID,CardYear,CardComments,CardImage ")] BaseballCard baseballCard)
        {
            if (ModelState.IsValid)
            {
                db.BaseballCard.Add(baseballCard);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ManufacturerID = new SelectList(db.ManufacturerInfo, "ManufacturerID", "ManufacturerName", baseballCard.ManufacturerID);
            ViewBag.PlayerID       = new SelectList(db.Player, "PlayerID", "PlayerName", baseballCard.PlayerID);
            ViewBag.CoachID        = new SelectList(db.Coach, "CoachID", "CoachName", baseballCard.CoachID);
            ViewBag.TeamID         = new SelectList(db.Team, "TeamID", "TeamName", baseballCard.TeamID);
            ViewBag.PositionID     = new SelectList(db.Position, "PositionID", "PositionName", baseballCard.PositionID);
            return(View(baseballCard));
        }
Ejemplo n.º 5
0
        // GET: BaseballCards/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BaseballCard baseballCard = db.BaseballCard.Find(id);

            if (baseballCard == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ManufacturerID = new SelectList(db.ManufacturerInfo, "ManufacturerID", "ManufacturerName", baseballCard.ManufacturerID);
            ViewBag.PlayerID       = new SelectList(db.Player, "PlayerID", "PlayerName", baseballCard.PlayerID);
            ViewBag.CoachID        = new SelectList(db.Coach, "CoachID", "CoachName", baseballCard.CoachID);
            ViewBag.TeamID         = new SelectList(db.Team, "TeamID", "TeamName", baseballCard.TeamID);
            ViewBag.PositionID     = new SelectList(db.Position, "PositionID", "PositionName", baseballCard.PositionID);
            return(View(baseballCard));
        }