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 }); }
Sometimes anonymous user can
harm our application and can change the data stored in our application. That’s
why, it is often necessary to permit only authorized users to use our
application. There is no predefined method
to do this operation in windows forms, so we have to implement it in our way.
If
we have username and password in our database then we can implement a better authentication system. So we will create a table in
our database named User which will have two columns (Username and Password). Insert some records in that table to check
our login control.
In click event of login button write following code:
Here in this code will show a
message if user leaves the textboxes empty. First check the username in our
database having exactly the same name user entered in textbox. If there is an entry
then compare the password.
We can show a message box at
each wrong step of user.
Download example.
Comments
Post a Comment