Exemplo n.º 1
0
        public async Task <ActionResult <ProfileDto> > Get()
        {
            try
            {
                var profiles = await _profileDataService.GetAllProfilesAsync();

                var images = new List <string>();
                foreach (var profile in profiles)
                {
                    images.Add(Path.Combine(Directory.GetCurrentDirectory(), profile.ImageModel.Url));
                }

                return(Ok(new Response
                {
                    Success = true,
                    Data = new ResponseData
                    {
                        ProfileModels = profiles,
                        Images = images
                    }
                }));
            }
            catch (Exception e)
            {
                return(BadRequest(new Response {
                    Success = false, ErrorMessage = e.Message
                }));
            }
        }