public IActionResult Get(long id) { Manfacturer Manfacturer = _dataRepository.Get(id); if (Manfacturer == null) { return(NotFound("The Manfacturer record couldn't be found.")); } return(Ok(Manfacturer)); }
public IActionResult Delete(long id) { Manfacturer Manfacturer = _dataRepository.Get(id); if (Manfacturer == null) { return(NotFound("The Manfacturer record couldn't be found.")); } _dataRepository.Delete(Manfacturer); return(NoContent()); }
public IActionResult Post([FromBody] Manfacturer Manfacturer) { if (Manfacturer == null) { return(BadRequest("Manfacturer is null.")); } _dataRepository.Add(Manfacturer); return(CreatedAtRoute( "Get", new { Id = Manfacturer.Id }, Manfacturer)); }
public IActionResult Put(long id, [FromBody] Manfacturer Manfacturer) { if (Manfacturer == null) { return(BadRequest("Manfacturer is null.")); } Manfacturer ManfacturerToUpdate = _dataRepository.Get(id); if (ManfacturerToUpdate == null) { return(NotFound("The Manfacturer record couldn't be found.")); } _dataRepository.Update(ManfacturerToUpdate, Manfacturer); return(NoContent()); }