Пример #1
0
        public ActionResult AddLeapee(CreateLeapeeRequest createRequest)
        {
            var repository = new LeapeeRepository();

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

            return(Created($"/api/leapee/{newLeapee.Id}", newLeapee));
        }
Пример #2
0
        public ActionResult <int> AddLeaper(CreateLeapeeRequest createRequest)
        {
            //if (!_validator.Validate(createRequest))
            //{
            //    return BadRequest(new { error = "leapers must have a first name, last name, and target leap" });
            //}

            var newLeaper = _leapeeRepository.AddLeapee(createRequest.FirstName, createRequest.LastName, createRequest.Event);

            return(Created($"api/leapee/{newLeaper.Id}", newLeaper));
        }
Пример #3
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));
        }
Пример #4
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));
        }
Пример #5
0
        public ActionResult CreateLeapee(CreateLeapeeRequest createRequest)
        {
            var newLeapee = _leapeeRepository.AddLeapee(createRequest.Name);

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