public IActionResult GetById(int id) { //Reason testThis = _repository.GetById<Reason>(id); var item = ReasonDTO.FromReason(_repository.GetById <Reason>(id)); return(Ok(item)); }
public IActionResult Put(int id, [FromBody] string value) { var reason = _repository.GetById <Reason>(id); reason.Description = value; reason.LastChangedBy = "Some User"; reason.LastChangedDateTime = DateTime.Now; _repository.Update(reason); return(Ok(ReasonDTO.FromReason(reason))); }
public IActionResult Post([FromBody] ReasonDTO item) { var newReason = new Reason() { Description = item.Description, LastChangedBy = "Some User", LastChangedDateTime = DateTime.Now }; _repository.Add(newReason); return(Ok(ReasonDTO.FromReason(newReason))); }