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 }); }
You can easily find largest number between two number using Max, which is static method of Math class. This method is overload with multiple data types, such as Max(Byte, Byte) , Max(Decimal, Decimal) and many more data types. Here we take an example with integer number.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int a = -3, b = 52;
Decimal deci = -4, deci1 = 53;
Console.WriteLine(" the maximum number in between a= {0} and b={1} are {2}",a,b, Math.Max(a, b));
Console.WriteLine(" the maximum number in between a= {0} and b={1} are {2}", deci, deci1, Math.Max(deci, deci1));
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int a = -3, b = 52;
Decimal deci = -4, deci1 = 53;
Console.WriteLine(" the maximum number in between a= {0} and b={1} are {2}",a,b, Math.Max(a, b));
Console.WriteLine(" the maximum number in between a= {0} and b={1} are {2}", deci, deci1, Math.Max(deci, deci1));
Console.ReadKey();
}
}
}
Comments
Post a Comment