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 }); }
larger = (a>b)? a:b;
The simple logic behind the program is, when a(variable) is greater than b, the value of a is assigned to larger(variable). Otherwise, the value of b is assigned to larger. The program to find the larger of two numbers using ternary operator is shown below:
#include<conio.h>
#include<stdio.h>
void main()
{
int a,b,larger;
clrscr();
printf("Enter a and b:\n");
scanf("%d%d",&a,&b);
/*The larger of a and b is stored in larger*/
larger=(a>b)?a:b;
printf("Larger=%d\n",larger);
getch();
}
Code generate the Following output
The simple logic behind the program is, when a(variable) is greater than b, the value of a is assigned to larger(variable). Otherwise, the value of b is assigned to larger. The program to find the larger of two numbers using ternary operator is shown below:
#include<conio.h>
#include<stdio.h>
void main()
{
int a,b,larger;
clrscr();
printf("Enter a and b:\n");
scanf("%d%d",&a,&b);
/*The larger of a and b is stored in larger*/
larger=(a>b)?a:b;
printf("Larger=%d\n",larger);
getch();
}
Code generate the Following output
Comments
Post a Comment