예제 #1
0
        public ActionResult <int> AddLeapee(CreateLeapeeRequest createRequest)
        {
            if (!_validator.Validate(createRequest))
            {
                return(BadRequest(new { error = "users must have a username" }));
            }

            var newLeapee = _leapeeRepository.AddLeapee(createRequest.Name, createRequest.Age);

            return(Created($"api/leapee/{newLeapee.Id}", newLeapee));
        }
예제 #2
0
        public ActionResult AddLeapee(CreateLeapeeRequest createRequest)
        {
            if (_validator.Validate(createRequest))
            {
                return(BadRequest(new { error = "leapee must have a name and profession" }));
            }

            var newLeapee = _leapeeRepository.AddLeapee(createRequest.LeapeeName, createRequest.Profession, createRequest.Gender);

            return(Created($"api/leapees/{newLeapee.Id}", newLeapee));
        }