Example #1
0
 public ActionResult Edit([Bind(Include = "teamID,teamName")] Team team)
 {
     if (ModelState.IsValid)
     {
         db.Entry(team).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(team));
 }
Example #2
0
 public ActionResult Edit([Bind(Include = "positionCode,positionDescription")] Position position)
 {
     if (ModelState.IsValid)
     {
         db.Entry(position).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(position));
 }
Example #3
0
 public ActionResult Edit([Bind(Include = "playerID,playerLastName,playerFirstName,positionCode,teamID")] Player player)
 {
     if (ModelState.IsValid)
     {
         db.Entry(player).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.positionCode = new SelectList(db.Positions, "positionCode", "positionDescription", player.positionCode);
     ViewBag.teamID       = new SelectList(db.Teams, "teamID", "teamName", player.teamID);
     return(View(player));
 }
Example #4
0
 public async Task <ActionResult <Team> > Put(int id, Team team)
 {
     if (id != team.TeamId)
     {
         return(BadRequest());
     }
     _db.Entry(team).State = EntityState.Modified;
     try
     {
         await _db.SaveChangesAsync();
     }
     catch (DbUpdateConcurrencyException)
     {
         if (!TeamExists(id))
         {
             return(NotFound());
         }
         else
         {
             throw;
         }
     }
     return(NoContent());
 }
Example #5
0
 public async Task <ActionResult <Player> > Put(int id, Player player)
 {
     if (id != player.PlayerId)
     {
         return(BadRequest());
     }
     _db.Entry(player).State = EntityState.Modified;
     try
     {
         await _db.SaveChangesAsync();
     }
     catch (DbUpdateConcurrencyException)
     {
         if (!PlayerExists(id))
         {
             return(NotFound());
         }
         else
         {
             throw;
         }
     }
     return(NoContent());
 }