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 to implement linear search:
LINEAR SEARCH (arr, n, key)[ ‘arr’ is one-dimensional array of size ‘n’, key is element to search ]
success <-- FALSE
[Assuming the lower bound of the array as 1]
I<--1
Repeat While (I<=n) AND (success = FALSE)
If (arr[I] = key) Then:
success <--TRUE
[End of If]
I<--I+1
[End of While]
Return success
Exit.
In this algorithm initially we assume that the search is unsuccessful by initializing a variable success as FALSE. Then we start the comparison of key from the first element by initializing the index variable I with 1. If the key is equal to first element then success is assigned with TRUE, which terminates the while loop. When the while loop is terminated the algorithm returns success as either TRUE or FALSE depending on the assignment. Similar comparisons are done with all the elements of the array by incrementing the index variable.
Comments
Post a Comment