예제 #1
0
        public async Task <IActionResult> PutPlayer([FromRoute] Guid id, [FromBody] Player player)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != player.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
 public ActionResult Edit([Bind(Include = "CompetitionId,Team,TeamId,Played,Won,Draw,Lost,For,Against,GD,Points")] Competition competition)
 {
     if (ModelState.IsValid)
     {
         db.Entry(competition).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(competition));
 }