Ejemplo n.º 1
0
        public async Task <IActionResult> GetAsync(int id)
        {
            var facultyDto = await _facultyService.GetAsync(id);

            var response = _facultyResponseComposer.ComposeForGet(facultyDto);

            return(response);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> GetAll()
        {
            try
            {
                var entity = await _service.GetAsync();

                return(Ok(_mapper.Map <ICollection <BL.Faculty>, ICollection <Faculty> >(entity)));
            }
            catch (Exception ex)
            {
                return(BadRequest($"{ex.Message}"));
            }
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> GetFaculty([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var faculty = await _facultyService.GetAsync(id);

            if (faculty == null)
            {
                return(NotFound());
            }

            return(Ok(faculty));
        }