public ActionResult Post([FromBody] team t)
 {
     if (ModelState.IsValid)
     {
         db.teams.Add(t);
         db.SaveChanges();
         return(CreatedAtAction("Post", t));
     }
     return(BadRequest(ModelState));
 }
示例#2
0
 public ActionResult Post([FromBody] player p)
 {
     if (ModelState.IsValid)
     {
         db.players.Add(p);
         db.SaveChanges();
         return(CreatedAtAction("Post", p));
     }
     return(BadRequest(ModelState));
 }