public bool CreatePokemonType(PokemonTypeCreate model) { var entity = new Data.Tables.Type() { TypeName = model.TypeName }; using (var ctx = new ApplicationDbContext()) { ctx.TypeDb.Add(entity); return(ctx.SaveChanges() == 1); } }
public IHttpActionResult PostPokemonType(PokemonTypeCreate pokemonType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreatePokemonTypeService(); if (!service.CreatePokemonType(pokemonType)) { return(InternalServerError()); } return(Ok()); }