コード例 #1
0
 public IActionResult Post([FromBody] PokemonEntity pokemon)
 {
     if (database.teamDatabase.Count == 6)
     {
         return(new ContentResult()
         {
             StatusCode = (int)HttpStatusCode.BadRequest,
             Content = "You have a full team and cannot add any new Pokemon."
         });
     }
     if (database.CheckIfinDatabase(pokemon.Id))
     {
         return(new ContentResult()
         {
             StatusCode = (int)HttpStatusCode.BadRequest,
             Content = "Species Clause: Can't have more than one of the same type of pokemon"
         });
     }
     if (pokemon.Name.Equals("MissingNo") && pokemon.Id.Equals("???") && pokemon.MoveOne.Equals("unknown"))
     {
         Claim MissingNo = new Claim("pokemon", "MissingNo");
         return(new JsonResult(this.securityProvider.GetToken(new List <Claim> {
             MissingNo
         })));
     }
     database.Add(pokemon.ToModel());
     return(new JsonResult(pokemon));
 }