public ActionResult <PlanetsSpecies> Create([FromBody] PlanetsSpecies newPS) { try { return(Ok(_serv.Create(newPS))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
public PlanetsSpecies Create(PlanetsSpecies newPS) { string sql = @" INSERT INTO planetsspecies (speciesId, planetId) VALUES (@SpeciesId, @PlanetId); SELECT LAST_INSERT_ID();"; int id = _db.ExecuteScalar <int>(sql, newPS); newPS.Id = id; return(newPS); }
public PlanetsSpecies Create(PlanetsSpecies newPS) { return(_repo.Create(newPS)); }