I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component public class AllViewComponent : ViewComponent { private readonly UserManager<ApplicationUser> _userManager; public AllViewComponent(UserManager<ApplicationUser> userManager) { _userManager = userManager; } public async Task<IViewComponentResult> InvokeAsync() { List<StudentViewModel> allUsers = new List<StudentViewModel>(); var items = await _userManager.Users.ToListAsync(); foreach (var item in items) { allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email }); }
Algorithm for binary search:
BINSEARCH (arr, n, key)
[‘arr’ elements are stored in ascending order]
success <--FALSE; FIRST<--1; LAST<--n
MID <--INTEGER((FIRST+LAST)/2)
Repeat While (FIRST <= LAST)
If(arr[MID] = key) Then:
success <-- TRUE; Return success
Else:
If arr[MID] > key Then:
LAST <-- MID - 1
Else:
FIRST <-- MID + 1
[End of If]
[End of If]
[End of While]
Return success
Exit.
In this algorithm when the while loop terminates the variable ‘success’ assigned with FALSE is returned. When the search is successful the algorithm terminates by returning the value of variable ‘success’ as TRUE. So we can check easily from the algorithm that the search unsuccessful when the variable value FIRST is greater then that of LAST.
Comments
Post a Comment