Пример #1
0
        public IActionResult Create([FromBody] Pirate pirate)
        {
            if (pirate == null)
            {
                return(BadRequest());
            }

            oDbContext.Add(pirate);
            oDbContext.SaveChanges();

            return(CreatedAtAction("GetById", new { id = pirate.Id }, pirate));
        }
        public ActionResult Post([FromBody] Pirate pirate)
        {
            if (pirate == null)
            {
                return(BadRequest());
            }

            oPirateDbContext.Add(pirate);
            oPirateDbContext.SaveChanges();

            return(CreatedAtAction(nameof(Get), new { id = pirate.PirateID }, pirate));
        }