Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4ba38bd

Browse files
IssueLockedException
1 parent 692e2a2 commit 4ba38bd

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

‎src/AspnetRun.Core/Entities/Issue.cs‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,25 @@ public void AssignTo([Required] User user, [Required] IIssueAssignmentPolicy pol
5050

5151
AssignedUserId = user.Id;
5252
}
53+
54+
public void ClearAssignment()
55+
{
56+
AssignedUserId = 0;
57+
}
58+
59+
public IssueComment AddComment(User creatorUser, string message)
60+
{
61+
Check.NotNull(creatorUser, nameof(creatorUser));
62+
63+
if (IsLocked)
64+
{
65+
throw new IssueLockedException(Id);
66+
}
67+
68+
var comment = new IssueComment(creatorUser.Id, message);
69+
_comments.Add(comment);
70+
return comment;
71+
}
72+
5373
}
5474
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace AspnetRun.Core.Exceptions
6+
{
7+
public class IssueLockedException : CoreException
8+
{
9+
public string IssueId { get; }
10+
11+
public IssueLockedException(string issueId)
12+
: base(issueId)
13+
{
14+
IssueId = issueId;
15+
}
16+
}
17+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /