public ProductEditViewModel(IProductsRepository repository, IEventAggregator eventAggregator, IAuthStore authStore, AttachmentsViewModel attachmentsViewModel) { this.repository = repository; this.eventAggregator = eventAggregator; this.authStore = authStore; this.attachmentsViewModel = attachmentsViewModel; SaveCommand = new DelegateCommand<ChildWindow>(Save); TabLoadedCommand = new DelegateCommand<object>(OnTabLoaded); }
public ProductEditWindowViewModel(IProductsRepository repository, IEventAggregator eventAggregator, IAuthStore authStore, AttachmentsViewModel attachmentsViewModel) { this.repository = repository; this.eventAggregator = eventAggregator; this.attachmentsViewModel = attachmentsViewModel; var token = authStore.LoadToken(); if (token != null) { canSave = token.IsEditor(); canEditPrice = token.IsAdmin(); } SaveCommand = new DelegateCommand(Save, () => canSave); CancelCommand = new DelegateCommand(() => IsWindowOpen = false); }