Beispiel #1
0
        public IActionResult GetById(int id)
        {
            var residence = _residencesService.Get(id);

            if (residence == null)
            {
                return(NotFound("Residence not found"));
            }

            var result = new ResidenceEditModel()
            {
                Id          = residence.Id,
                Name        = residence.Name,
                Address     = residence.Address,
                Description = residence.Description,
                IsAvailable = residence.IsAvailable,
                ImageUrl    = residence.ImageUrl,
                ThumbUrl    = residence.ThumbnailUrl,
                CreatedAt   = residence.CreatedAt.GetValueOrDefault(new DateTime(2019, 01, 01)),
                CreatedBy   = residence.CreatedBy,
                UpdatedAt   = residence.UpdatedAt,
                UpdatedBy   = residence.UpdatedBy
            };

            return(Ok(result));
        }
Beispiel #2
0
        public ResidencesPageViewModel(IResidencesService residencesService, IDialogHost dialogHost, Hotel hotel)
        {
            _residencesService = residencesService;
            _dialogHost        = dialogHost;
            _hotel             = hotel;

            Residences = new ObservableCollection <Residence>(_residencesService.Get());
        }