Skip to content

Commit

Permalink
Add finding rules for Department and CityPhoneNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
shashinma committed Jul 8, 2024
1 parent 3c56314 commit faac465
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Controllers/PhoneBookController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public PhoneBookController(PhonebookContext context)
}

[AllowAnonymous]
public async Task<IActionResult> Index(string searchString, string currentFilter, int? cPage)
public async Task<IActionResult> Index(string? searchString, string? currentFilter, int? cPage)
{
if (searchString != null)
{
Expand All @@ -37,9 +37,11 @@ public async Task<IActionResult> Index(string searchString, string currentFilter
{
entriesQuery = entriesQuery.Where(e =>
e.Name.Contains(searchString) ||
e.Department.Contains(searchString) ||
e.Mail.Contains(searchString) ||
e.Room.Contains(searchString) ||
e.LocalPhoneNumber.Contains(searchString) ||
e.CityPhoneNumber.Contains(searchString) ||
e.PersonnelNumber.Contains(searchString));
}

Expand Down Expand Up @@ -78,7 +80,7 @@ public IActionResult Create()
}

// POST: PhoneBook/Create
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
Expand Down Expand Up @@ -148,7 +150,7 @@ public async Task<IActionResult> Edit(int id, [Bind("Id,PersonnelNumber,Name,Pos
}
return View(bookEntry);
}

// GET: PhoneBook/Delete/5
public async Task<IActionResult> Delete(int? id)
{
Expand Down Expand Up @@ -182,7 +184,7 @@ private bool BookEntryExists(int id)
{
return _context.Entries.Any(e => e.Id == id);
}

// Valid only if personnelNumber is unique
private bool VerifyPersonnelNumber(string personnelNumber, int id)
{
Expand Down

0 comments on commit faac465

Please # to comment.