From faac4654322a340dcced0baa2b7c97683f839c7d Mon Sep 17 00:00:00 2001 From: Mikhail Shashin Date: Mon, 8 Jul 2024 18:52:39 +0300 Subject: [PATCH] Add finding rules for Department and CityPhoneNumber --- Controllers/PhoneBookController.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Controllers/PhoneBookController.cs b/Controllers/PhoneBookController.cs index 284e883..084b6f6 100644 --- a/Controllers/PhoneBookController.cs +++ b/Controllers/PhoneBookController.cs @@ -18,7 +18,7 @@ public PhoneBookController(PhonebookContext context) } [AllowAnonymous] - public async Task Index(string searchString, string currentFilter, int? cPage) + public async Task Index(string? searchString, string? currentFilter, int? cPage) { if (searchString != null) { @@ -37,9 +37,11 @@ public async Task 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)); } @@ -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] @@ -148,7 +150,7 @@ public async Task Edit(int id, [Bind("Id,PersonnelNumber,Name,Pos } return View(bookEntry); } - + // GET: PhoneBook/Delete/5 public async Task Delete(int? id) { @@ -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) {