public AnimalModel Post([FromBody] NewAnimalModel value) { var result = new AnimalModel(value.Name); _animals.Add(result); return(result); }
public AnimalModel Put(Guid id, [FromBody] NewAnimalModel value) { var model = _animals.FirstOrDefault(x => x.Id == id); if (model == null) { throw new Exception("Id not found"); } model.Name = value.Name; return(model); }