public List <Trainee> Put(Trainee trainee) { if (trainee == null) { throw new ArgumentNullException("trainee"); } int index = names.FindIndex(p => p.Id == trainee.Id); if (index == -1) { throw new HttpResponseException(HttpStatusCode.NotFound); } else { names.RemoveAt(index); names.Add(trainee); return(names); } }
public IHttpActionResult Post(Trainee trainee) { names.Add(trainee); return(Ok(names)); }