Skip to content

Commit 05bf1f5

Browse files
committed
Add namespaces to fix warnings
1 parent 60a3b29 commit 05bf1f5

File tree

3 files changed

+54
-49
lines changed

3 files changed

+54
-49
lines changed
Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1-
using System.Diagnostics;
2-
using Microsoft.AspNetCore.Mvc;
3-
using Microsoft.AspNetCore.Mvc.RazorPages;
4-
5-
namespace text_counter_razor.Pages;
6-
7-
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
8-
[IgnoreAntiforgeryToken]
9-
public class ErrorModel : PageModel
1+
namespace text_counter_razor.Pages
102
{
11-
public string? RequestId { get; set; }
3+
using System.Diagnostics;
4+
using Microsoft.AspNetCore.Mvc;
5+
using Microsoft.AspNetCore.Mvc.RazorPages;
126

13-
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
7+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
8+
[IgnoreAntiforgeryToken]
9+
public class ErrorModel : PageModel
10+
{
11+
public string? RequestId { get; set; }
1412

15-
private readonly ILogger<ErrorModel> _logger;
13+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
1614

17-
public ErrorModel(ILogger<ErrorModel> logger)
18-
{
19-
_logger = logger;
20-
}
15+
private readonly ILogger<ErrorModel> _logger;
2116

22-
public void OnGet()
23-
{
24-
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
17+
public ErrorModel(ILogger<ErrorModel> logger)
18+
{
19+
_logger = logger;
20+
}
21+
22+
public void OnGet()
23+
{
24+
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
25+
}
2526
}
2627
}
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
using Microsoft.AspNetCore.Mvc;
2-
using Microsoft.AspNetCore.Mvc.RazorPages;
3-
4-
namespace text_counter_razor.Pages;
5-
6-
public class IndexModel : PageModel
1+
namespace text_counter_razor.Pages
72
{
8-
private readonly ILogger<IndexModel> _logger;
3+
using Microsoft.AspNetCore.Mvc;
4+
using Microsoft.AspNetCore.Mvc.RazorPages;
95

10-
public IndexModel(ILogger<IndexModel> logger)
6+
public class IndexModel : PageModel
117
{
12-
_logger = logger;
13-
}
8+
private readonly ILogger<IndexModel> _logger;
149

15-
public void OnGet() { }
10+
public IndexModel(ILogger<IndexModel> logger)
11+
{
12+
_logger = logger;
13+
}
14+
15+
public void OnGet() { }
16+
}
1617
}
Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
1-
using Microsoft.AspNetCore.Mvc;
2-
using Microsoft.AspNetCore.Mvc.RazorPages;
3-
4-
public class TextCounterModel : PageModel
1+
namespace text_counter_razor.Pages
52
{
6-
[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
3+
using Microsoft.AspNetCore.Mvc;
4+
using Microsoft.AspNetCore.Mvc.RazorPages;
115

12-
public void OnPost()
6+
public class TextCounterModel : PageModel
137
{
14-
this.TextContent = this.Request.Form["textContent"]; //get text box input
15-
this.Characters = this.TextContent?.Length ?? 0; //update number of characters, words and lines based on entered text
16-
this.Words =
17-
this.TextContent?.Split(
18-
new char[] { ' ', '\r', '\n' },
19-
StringSplitOptions.RemoveEmptyEntries
20-
).Length ?? 0;
21-
this.Lines =
22-
this.TextContent?.Split('\n', StringSplitOptions.RemoveEmptyEntries).Length ?? 0;
8+
[BindProperty]
9+
public string? TextContent { get; set; } //text content string input from text box
10+
public int Characters { get; set; } //number of characters
11+
public int Words { get; set; } //number of words
12+
public int Lines { get; set; } //number of lines
13+
14+
public void OnPost()
15+
{
16+
this.TextContent = this.Request.Form["textContent"]; //get text box input
17+
this.Characters = this.TextContent?.Length ?? 0; //update number of characters, words and lines based on entered text
18+
this.Words =
19+
this.TextContent?.Split(
20+
new char[] { ' ', '\r', '\n' },
21+
StringSplitOptions.RemoveEmptyEntries
22+
).Length ?? 0;
23+
this.Lines =
24+
this.TextContent?.Split('\n', StringSplitOptions.RemoveEmptyEntries).Length ?? 0;
25+
}
2326
}
2427
}

0 commit comments

Comments
 (0)