public IActionResult Delete(int?Id) { if (HttpContext.Session.GetString("ID") == null) { return(RedirectToAction("Login", "Admin")); } else { if (Id == null) { //Error return(RedirectToAction("NotFoundPage", "Home")); } else { Office model = officeRepository.GetOffice(Id); return(View(model)); } } }