Skip to content

Commit 2c36513

Browse files
committed
Refactor message entity and add validation
- Refactored the Message class in RazorPagesTestSample.Data to RazorPagesTestSample. - Added validation for the text content of the message, ensuring it is required and has a maximum length of 250 characters. Resolves #6
1 parent 46ecb87 commit 2c36513

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"sarif-viewer.connectToGithubCodeScanning": "off"
3+
}
Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
using System.ComponentModel.DataAnnotations;
22

3-
namespace RazorPagesTestSample.Data
3+
/// <summary>
4+
/// Represents a message entity with an ID and text content.
5+
/// </summary>
6+
namespace RazorPagesTestSample
47
{
5-
#region snippet1
68
public class Message
79
{
10+
/// <summary>
11+
/// Gets or sets the unique identifier for the message.
12+
/// </summary>
813
public int Id { get; set; }
914

15+
/// <summary>
16+
/// Gets or sets the text content of the message.
17+
/// </summary>
18+
/// <remarks>
19+
/// The text content is required and must be a string with a maximum length of 250 characters.
20+
/// </remarks>
1021
[Required]
1122
[DataType(DataType.Text)]
12-
[StringLength(200, ErrorMessage = "There's a 200 character limit on messages. Please shorten your message.")]
23+
[StringLength(250, ErrorMessage = "There's a 250 character limit on messages. Please shorten your message.")]
1324
public string Text { get; set; }
1425
}
15-
#endregion
16-
}
26+
27+
}

0 commit comments

Comments
 (0)