Beispiel #1
0
        public async Task <ActionResult <InternshipModel[]> > Get()
        {
            try
            {
                var results = await _repository.GetAllInternshipsAsync();

                if (!results.Any())
                {
                    return(NotFound("No Internships in the database"));
                }

                return(_mapper.Map <InternshipModel[]>(results));
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, "Database failure"));
            }
        }
        public async Task <ActionResult <IEnumerable <Internship> > > GetInternships()
        {
            IEnumerable <Internship> internships = await _repository.GetAllInternshipsAsync();

            return(Ok(_mapper.Map <IEnumerable <InternshipDTO> >(internships)));
        }