public string CreateIssue(string title, string description, IssuePriorities priority, string[] strings)
        {
            if (this.Data.CurrentlyLoggedInUser == null)
            {
                return Constants.NoCurrentlyLogedinUserMsg;
            }

            Issue issue = new Issue(title, description, priority, strings.Distinct().ToList());
            issue.Id = this.Data.NextIssueId;

            this.Data.IssuesById.Add(issue.Id, issue);
            this.Data.NextIssueId++;
            this.Data.IssuesByUserName[this.Data.CurrentlyLoggedInUser.UserName].Add(issue);

            foreach (var tag in issue.Tags)
            {
                this.Data.IssuesByTag[tag].Add(issue);
            }

            return string.Format(Constants.IssueCreatedSuccessfullyMsg, issue.Id);
        }
Ejemplo n.º 2
0
        public string CreateIssue(string title, string description, IssuePriority priority, string[] tags)
        {
            // If there is no logged in user, the action returns There is no currently logged in user
            if (this.Data.CurrentUser == null)
            {
                return "There is no currently logged in user";
            }

            // In case of success, the action returns Issue <id> created successfully
            var issue = new Issue(title, description, priority, tags.Distinct().ToList());
            this.Data.AddIssue(issue);
            return string.Format("Issue {0} created successfully.", issue.Id);
        }