Example #1
0
        public IList <Dto.Model.Person.ListResponse> List()
        {
            var personList = _personRepository.ListAll().ToList();
            var groupList  = _ageGroupRepository.ListAll().ToList();

            var adapter = new Dto.Adapter.Person.ListResponse();

            return(adapter.Transform(groupList, personList));
        }
Example #2
0
        public IList <Dto.Model.Person.ListResponse> List([FromBody] Dto.Model.Person.ListRequest payload)
        {
            var result = new List <Dto.Model.Person.ListResponse>();

            if (payload != null && ModelState.IsValid)
            {
                var personList = _personRepository.ListByName(payload.Name).ToList();
                var groupList  = _ageGroupRepository.ListAll().ToList();

                var adapter = new Dto.Adapter.Person.ListResponse();
                result = adapter.Transform(groupList, personList);
            }
            else
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
            }

            return(result);
        }