private int GetUserId() { int id = -1; if (_context != null && _context.CurrentUser.Role == Library_Enterprise_University_Project.DataInterface.Enums.Role.Reader) { id = _context.CurrentUser.Id; } else if (_context != null && _context.CurrentUser.Role == Library_Enterprise_University_Project.DataInterface.Enums.Role.Librarian || _context.CurrentUser.Role == Library_Enterprise_University_Project.DataInterface.Enums.Role.Admin) { var searchUserController = new SearchUserController(new SearchUserView(), _context); id = searchUserController.GetId() != null ? searchUserController.GetId() : -1; } else { _view.PrintMessageBoxAndClose("No user defined"); } return id; }
private int GetUserId() { int id = -1; if (_context != null && _context.CurrentUser.Role == DataInterface.Enums.Role.Reader) { id = _context.CurrentUser.Id; } else if (_context != null && _context.CurrentUser.Role == DataInterface.Enums.Role.Librarian || _context.CurrentUser.Role == DataInterface.Enums.Role.Admin) { var searchUserController = new SearchUserController(new SearchUserView(), _context); id = searchUserController.GetId() != null ? searchUserController.GetId() : -1; } else { MessageBox.Show("No user defined"); _searchBookView.Close(); } return id; }