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 }); }
In this example, we will show that a directory,which contains lots of file, converted into compressed folder. There are many steps for designing this algorithm, these are
Step-1 : Add 'System.IO.Compression.FileSystem' assembly into your project.
assembly exist into your windows directory
(~/Windows/Microsoft.NET/assembly/GAC_MSIL/System.IO.Compression.FileSystem/(Your .NET Version)
Step-1 : Add 'System.IO.Compression.FileSystem' assembly into your project.
assembly exist into your windows directory
(~/Windows/Microsoft.NET/assembly/GAC_MSIL/System.IO.Compression.FileSystem/(Your .NET Version)
Step-2 : copy this code, paste into your source code
using System.IO.Compression;
using System.IO;
namespace compressiondecompress
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string source = @"e:\web";
string dest = @"e:\web.zip";
ZipFile.CreateFromDirectory(source, dest);
}
}
}
Code generate the following output
Comments
Post a Comment