Ejemplo n.º 1
0
        public void EditProject(int id, string projectName, string projectKey)
        {
            if (!Regex.IsMatch(projectKey, "\\b\\w{2,5}\\b"))
            {
                throw new CheckedException("Key must contains only uppercase alphabetical letters or digits, and must have at least 2 and at most 5 characters.");
            }

            if (_projectDAO.GetProjectByKey(projectKey).Id != id)
            {
                throw new CheckedException($"Key {projectKey} has already been used.");
            }

            _projectDAO.EditProjectInfo(id, projectName, projectKey);
        }