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 }); }
This example is little complex. You will understand it more clearly after reading the user defined data types.
Problem: Design an algorithm to find average of SALARY in an array of EMP struct containing information EMPNO, EMPNAME, and SALARY.
Input: A list employees of the type struct.
Output : Display the average of SALARY.
AVG_SALARY(LIST, SIZE)
[LIST is an array of EMP, SIZE is size of array]
SUM<-- 0
Repeat For I=1,2,3,........SIZE
SUM<--SUM +LIST[I].SALARY
[END of For I]
AVG <-- SUM / SIZE
Write : 'The average Salary is', AVG
Exit
Note : An algorithm, that perform sub-task, may be called in another algorithm. It is a better practice to divide the given problem into sub-problems ans write the individual algorithm to solve such sub-problems. Write the main algorithm to call the sub-algorithms in order to solve the main problem.
Problem: Design an algorithm to find average of SALARY in an array of EMP struct containing information EMPNO, EMPNAME, and SALARY.
Input: A list employees of the type struct.
Output : Display the average of SALARY.
AVG_SALARY(LIST, SIZE)
[LIST is an array of EMP, SIZE is size of array]
SUM<-- 0
Repeat For I=1,2,3,........SIZE
SUM<--SUM +LIST[I].SALARY
[END of For I]
AVG <-- SUM / SIZE
Write : 'The average Salary is', AVG
Exit
Note : An algorithm, that perform sub-task, may be called in another algorithm. It is a better practice to divide the given problem into sub-problems ans write the individual algorithm to solve such sub-problems. Write the main algorithm to call the sub-algorithms in order to solve the main problem.
Comments
Post a Comment