public IActionResult CreateAirsoftModels([FromBody] AirsoftModel newAirsoftModel) { //Book toevoegen in de databank, Id wordt dan ook toegekend context.AirsoftModels.Add(newAirsoftModel); context.SaveChanges(); // Stuur een result 201 met het boek als content return(Created("a new airsoftmodel", newAirsoftModel)); }
public IActionResult UpdateAirsoftModels([FromBody] AirsoftModel UpdateAirsoftModel) { var orgAirsoftmodel = context.AirsoftModels.Find(UpdateAirsoftModel.Id); if (orgAirsoftmodel == null) { return(NotFound()); } orgAirsoftmodel.name = UpdateAirsoftModel.name; orgAirsoftmodel.type = UpdateAirsoftModel.type; orgAirsoftmodel.operatingsystem = UpdateAirsoftModel.operatingsystem; orgAirsoftmodel.propulsion = UpdateAirsoftModel.propulsion; orgAirsoftmodel.BrandId = UpdateAirsoftModel.BrandId; context.SaveChanges(); return(Ok(orgAirsoftmodel)); }