コード例 #1
0
 public void Post(string name)
 {
     _context.Players.Add(new Player()
     {
         Name = name
     });
     _context.SaveChanges();
 }
コード例 #2
0
        public void Post(int cardId, int handId)
        {
            Card c = new Card()
            {
                CardId = cardId, HandId = handId
            };

            _context.Cards.Add(c);
            _context.SaveChanges();
        }
コード例 #3
0
 public void Post(int playerId, [FromBody] Hand hand)
 {
     hand.PlayerId = playerId;
     _context.Hands.Add(hand);
     foreach (Card c in hand.Cards)
     {
         c.HandId = hand.Id;
         _context.Cards.Add(c);
     }
     _context.SaveChanges();
 }