Пример #1
0
        public async Task <ActionResult <Response> > Get(int id)
        {
            try
            {
                var profile = await _profileDataService.GetProfileByIdAsync(id);

                return(Ok(new Response
                {
                    Success = true,
                    Data = new ResponseData
                    {
                        ProfileModels = new List <ProfileDto> {
                            profile
                        },
                        Images = new List <string> {
                            Path.Combine(Directory.GetCurrentDirectory(), profile.ImageModel.Url)
                        },
                        OfficeModels = new List <OfficeDto> {
                            await _officeDataService.GetOfficeContainingProfileIdAsync(profile.Id)
                        }
                    }
                }));
            }
            catch (Exception e)
            {
                return(BadRequest(new Response {
                    Success = false, ErrorMessage = e.Message
                }));
            }
        }