示例#1
0
        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);
            }
        }
示例#2
0
 public IHttpActionResult Post(Trainee trainee)
 {
     names.Add(trainee);
     return(Ok(names));
 }