public IActionResult Post([FromBody] Phoebus phoebus) { _PhRespository.UpdatePhoebus(phoebus); PhoebusDTO phoebusDTO = _mapper.Map <Phoebus, PhoebusDTO>(phoebus); phoebusDTO.Links.Add( new LinkDTO("self", Url.Link("GetId", new { id = phoebusDTO.PhoebusId }), "GET")); return(Created($"/api/Phoebus/{phoebusDTO.PhoebusId}", phoebusDTO)); }
public IActionResult Put(int id, [FromBody] Phoebus ph) { if (_PhRespository.GetById(id) == null) { return(NotFound()); } if (ph == null) { return(BadRequest()); } if (!ModelState.IsValid) { return(UnprocessableEntity(ModelState)); } ph.PhoebusId = id; _PhRespository.UpdatePhoebus(ph); return(Ok()); }