main
 1using gorilla.commons.utility;
 2using MoMoney.Presentation.Model.Projects;
 3
 4namespace momoney.presentation.model.menu.file
 5{
 6    public interface ISaveCommand : Command {}
 7
 8    public class SaveCommand : ISaveCommand
 9    {
10        readonly IProjectController the_current_project;
11        readonly ISaveAsCommand save_as_command;
12
13        public SaveCommand(IProjectController current_project, ISaveAsCommand save_as_command)
14        {
15            the_current_project = current_project;
16            this.save_as_command = save_as_command;
17        }
18
19        public void run()
20        {
21            if (the_current_project.has_been_saved_at_least_once()) the_current_project.save_changes();
22            else save_as_command.run();
23        }
24    }
25}