예제 #1
0
        public HumanModel Post([FromBody] NewHumanModel value)
        {
            var result = new HumanModel(value.Name);

            _humans.Add(result);

            return(result);
        }
예제 #2
0
        public HumanModel Put(Guid id, [FromBody] NewHumanModel value)
        {
            var model = _humans.FirstOrDefault(x => x.Id == id);

            if (model == null)
            {
                throw new Exception("Id not found");
            }

            model.Name = value.Name;
            return(model);
        }