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 }); }
Both method include in single program
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int a = 2, b = 4;
Console.WriteLine(" The power of given number is {0}",Math.Pow(a, b));
// Second method
int result= Fun(2, 6);
Console.WriteLine(" The power of given number is {0}", result);
Console.ReadKey();
}
private static int Fun(int a, int b)
{
if (b >= 1)
{
return (a * Fun(a, --b));
}
else
return 1;
}
}
}
Comments
Post a Comment