Example #1
0
        public async Task <IActionResult> PutRoster(int id, Roster roster)
        {
            if (id != roster.PMId)
            {
                return(BadRequest());
            }

            _context.Entry(roster).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RosterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #2
0
 public ActionResult Edit([Bind(Include = "ID,Name,City")] Team team)
 {
     if (ModelState.IsValid)
     {
         db.Entry(team).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(team));
 }
Example #3
0
 public ActionResult Edit([Bind(Include = "ID,LastName,FirstName,Age,PlayerNumber,TeamID,Position,Hits")] Player player)
 {
     if (ModelState.IsValid)
     {
         db.Entry(player).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.TeamID = new SelectList(db.Teams, "ID", "Name", player.TeamID);
     return(View(player));
 }