Пример #1
0
        private async Task AddArchitecture()
        {
            var architecture = new ArchitectureModel(
                Title, CreatedYear, Country, City, Address,
                Square, Heigth, State, Architect.Id, Style.Id);

            await _architecturesManager.AddArchitecture(architecture);

            _customNavigationService.NavigateTo(PageKeys.ArchitectureMain);
        }
Пример #2
0
        private void SetupFields()
        {
            ArchitectureModel editableArch = _architecture;

            Title       = editableArch?.Title ?? string.Empty;
            CreatedYear = editableArch?.CreationYear ?? Convert.ToInt32(DateTime.Now.Year);
            Country     = editableArch?.Country ?? string.Empty;
            City        = editableArch?.City ?? string.Empty;
            Address     = editableArch?.Address ?? string.Empty;
            Square      = editableArch?.Square ?? 0;
            Heigth      = editableArch?.Height ?? 0;
            State       = editableArch?.State ?? State.Great;
            Architect   = editableArch?.Architect;
            Style       = editableArch?.Style;
        }
Пример #3
0
        public ArchitectureAddViewModel(
            IArchitecturesManager architecturesManager,
            IStylesManager stylesManager,
            IArchitectManager architectsManager)
        {
            _architecturesManager    = architecturesManager;
            _stylesManager           = stylesManager;
            _architectsManager       = architectsManager;
            _customNavigationService = ServiceLocator.Current.GetInstance <ICustomNavigationService>("ArchitectureInternal");

            _architecture = _customNavigationService.CurrentPageParams as ArchitectureModel;

            SaveCommand = _architecture == null
                ? new RelayCommand(async() => await AddArchitecture())
                : new RelayCommand(async() => await UpdateArchitecture());

            ActionText = _architecture == null ? "Добавление" : "Редактирование";
            ButtonText = _architecture == null ? "Добавить" : "Сохранить изменения";

            InitData();
            SetupFields();
        }