Skip to content

Commit feaa8df

Browse files
committed
Fix naming warnings
1 parent ea05d57 commit feaa8df

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

text-counter-razor/Pages/TextCounter.cshtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
}
66
<h1>Text Counter in Razor Pages</h1>
77
<form method="post">
8-
<textarea id="textContent" name="textContent" rows="10" cols="80" asp-for="textContent"></textarea><br />
8+
<textarea id="textContent" name="textContent" rows="10" cols="80" asp-for="TextContent"></textarea><br />
99
<button>Update Text Counter Output</button><br />
1010
</form>
11-
<div id="textOutput">Characters: @Model.characters.ToString("N0")<br />Words: @Model.words.ToString("N0")<br />Lines:
12-
@Model.lines.ToString("N0")
11+
<div id="textOutput">Characters: @Model.Characters.ToString("N0")<br />Words: @Model.Words.ToString("N0")<br />Lines:
12+
@Model.Lines.ToString("N0")
1313
</div>

text-counter-razor/Pages/TextCounter.cshtml.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
public class TextCounterModel : PageModel
55
{
66
[BindProperty]
7-
public string? textContent { get; set; } //text content string input from text box
8-
public int characters { get; set; } //number of characters
9-
public int words { get; set; } //number of words
10-
public int lines { get; set; } //number of lines
7+
public string? TextContent { get; set; } //text content string input from text box
8+
public int Characters { get; set; } //number of characters
9+
public int Words { get; set; } //number of words
10+
public int Lines { get; set; } //number of lines
1111

1212
public void OnPost()
1313
{
14-
textContent = Request.Form["textContent"]; //get text box input
15-
characters = textContent?.Length ?? 0; //update number of characters, words and lines based on entered text
16-
words =
17-
textContent
14+
TextContent = Request.Form["textContent"]; //get text box input
15+
Characters = TextContent?.Length ?? 0; //update number of characters, words and lines based on entered text
16+
Words =
17+
TextContent
1818
?.Split(new char[] { ' ', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)
1919
.Length ?? 0;
20-
lines = textContent?.Split('\n', StringSplitOptions.RemoveEmptyEntries).Length ?? 0;
20+
Lines = TextContent?.Split('\n', StringSplitOptions.RemoveEmptyEntries).Length ?? 0;
2121
}
2222
}

0 commit comments

Comments
 (0)