コード例 #1
0
        public async Task <IActionResult> PutCurrentPartie(int id, CurrentPartie currentPartie)
        {
            if (id != currentPartie.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <ActionResult <Partie> > AddCurrentPartie(CurrentPartie currentPartie)
        {
            _context.CurrentPartie.Add(currentPartie);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPartie", new { id = currentPartie.Id }, currentPartie));
        }