コード例 #1
0
        public IQueryable <HostingResumeViewModel> GetAll(int userId)
        {
            var resumeViewModels = new List <HostingResumeViewModel>();
            var resumeViewModel  = new HostingResumeViewModel();

            var hostings = _hostingService.GetAll(userId);

            foreach (var hosting in hostings)
            {
                resumeViewModel.Id               = hosting.Id;
                resumeViewModel.Description      = hosting.Description;
                resumeViewModel.Price            = hosting.Price;
                resumeViewModel.Note             = hosting.Note;
                resumeViewModel.Neighborhood     = hosting.Neighborhood;
                resumeViewModel.City             = hosting.City;
                resumeViewModel.AnimalSize       = hosting.AnimalSize;
                resumeViewModel.HasDog           = hosting.HasDog;
                resumeViewModel.PlaceDescription = hosting.PlaceDescription;
                resumeViewModel.PatioSize        = hosting.PatioSize;
                resumeViewModel.HousingType      = hosting.HousingType;
                resumeViewModel.User             = hosting.User.Name;

                resumeViewModels.Add(resumeViewModel);
                resumeViewModel = new HostingResumeViewModel();
            }

            return(resumeViewModels.AsQueryable());
        }
コード例 #2
0
        public async Task <HostingResumeViewModel> GetById(int id)
        {
            var resumeViewModel = new HostingResumeViewModel();

            var hosting = await _hostingService.GetById(id);

            resumeViewModel.Id               = hosting.Id;
            resumeViewModel.Description      = hosting.Description;
            resumeViewModel.Price            = hosting.Price;
            resumeViewModel.Note             = hosting.Note;
            resumeViewModel.Neighborhood     = hosting.Neighborhood;
            resumeViewModel.City             = hosting.City;
            resumeViewModel.AnimalSize       = hosting.AnimalSize;
            resumeViewModel.HasDog           = hosting.HasDog;
            resumeViewModel.PlaceDescription = hosting.PlaceDescription;
            resumeViewModel.PatioSize        = hosting.PatioSize;
            resumeViewModel.HousingType      = hosting.HousingType;
            resumeViewModel.User             = hosting.User.Name;
            resumeViewModel.TelephoneNumber  = hosting.User.TelephoneNumber;

            return(resumeViewModel);
        }