public bool UpdatePokemonType(PokemonTypeEdit model) { using (var ctx = new ApplicationDbContext()) { var entity = ctx.TypeDb .Single(e => e.TypeID == e.TypeID); entity.TypeName = model.TypeName; return(ctx.SaveChanges() == 1); } }
public IHttpActionResult EditPokemonType(PokemonTypeEdit pokemonType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreatePokemonTypeService(); if (!service.UpdatePokemonType(pokemonType)) { return(InternalServerError()); } return(Ok()); }