private bool ValidateCommand(string[] entryAttributes) { string entryText = entryAttributes[1]; string dateOrTime = entryAttributes[0]; if (Validators.IsValidTime(dateOrTime)) { return(agendaController.AddEntry(entryText, string.Empty, dateOrTime)); } else if (Validators.IsValidDate(dateOrTime)) { return(agendaController.AddEntry(entryText, dateOrTime, string.Empty)); } else { return(false); } }
public bool ExecuteTask(string userEntry, string[] commandOptions) { string[] controllerCommands = commandOptions; string entryText = controllerCommands[2]; string entryDate = controllerCommands[0]; string entryTime = controllerCommands[1]; if (Validators.IsValidDate(entryDate) && Validators.IsValidTime(entryTime)) { return(agendaController.AddEntry(entryText, entryDate, entryTime)); } else { return(false); } }
public bool ExecuteTask(string entryText, string[] optionCommands = null) { optionCommands = entryText.Split('|'); return(agendaController.AddEntry(optionCommands[0], optionCommands[1], optionCommands[2])); }