master
 1using Notepad.Infrastructure.Core;
 2using Notepad.Presentation.Core;
 3using Notepad.Presentation.Presenters.Menu.File;
 4using Notepad.Tasks;
 5
 6namespace Notepad.Presentation.Model.Menu.File.Commands {
 7    public interface ISaveCommand : ICommand {}
 8
 9    public class SaveCommand : ISaveCommand {
10        private readonly IApplicationController controller;
11        private readonly IDocumentTasks tasks;
12
13        public SaveCommand(IApplicationController controller, IDocumentTasks tasks) {
14            this.controller = controller;
15            this.tasks = tasks;
16        }
17
18        public void Execute() {
19            if (!tasks.HasAPathToSaveToBeenSpecified()) {
20                controller.Run<ISaveAsPresenter>();
21            }
22            else {
23                tasks.SaveTheActiveDocument();
24            }
25        }
26    }
27}