Skip to content

Commit

Permalink
Fix naming warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
lulunac27a committed Nov 11, 2024
1 parent ea05d57 commit feaa8df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions text-counter-razor/Pages/TextCounter.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
}
<h1>Text Counter in Razor Pages</h1>
<form method="post">
<textarea id="textContent" name="textContent" rows="10" cols="80" asp-for="textContent"></textarea><br />
<textarea id="textContent" name="textContent" rows="10" cols="80" asp-for="TextContent"></textarea><br />
<button>Update Text Counter Output</button><br />
</form>
<div id="textOutput">Characters: @Model.characters.ToString("N0")<br />Words: @Model.words.ToString("N0")<br />Lines:
@Model.lines.ToString("N0")
<div id="textOutput">Characters: @Model.Characters.ToString("N0")<br />Words: @Model.Words.ToString("N0")<br />Lines:
@Model.Lines.ToString("N0")
</div>
18 changes: 9 additions & 9 deletions text-counter-razor/Pages/TextCounter.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
public class TextCounterModel : PageModel
{
[BindProperty]
public string? textContent { get; set; } //text content string input from text box
public int characters { get; set; } //number of characters
public int words { get; set; } //number of words
public int lines { get; set; } //number of lines
public string? TextContent { get; set; } //text content string input from text box
public int Characters { get; set; } //number of characters
public int Words { get; set; } //number of words
public int Lines { get; set; } //number of lines

public void OnPost()
{
textContent = Request.Form["textContent"]; //get text box input
characters = textContent?.Length ?? 0; //update number of characters, words and lines based on entered text
words =
textContent
TextContent = Request.Form["textContent"]; //get text box input
Characters = TextContent?.Length ?? 0; //update number of characters, words and lines based on entered text
Words =
TextContent
?.Split(new char[] { ' ', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)
.Length ?? 0;
lines = textContent?.Split('\n', StringSplitOptions.RemoveEmptyEntries).Length ?? 0;
Lines = TextContent?.Split('\n', StringSplitOptions.RemoveEmptyEntries).Length ?? 0;
}
}

0 comments on commit feaa8df

Please sign in to comment.