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 }); }
Its a very easy concepts, finding traveling time, which is travel by a train. Suppose your train arrival Date and time is 2/9/2014 10:47:00 PM and departure date time is 2/8/2014 6:32:00 PM . Now, you want to get total traveling time. Use TimeSpan Structure for getting elapsed time. Lets take an simple example.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication8
{
class Program
{
static void Main(string[] args)
{
DateTime departure = new DateTime(2014, 2, 8, 18, 32, 0);
DateTime arrival = new DateTime(2014, 2, 9, 22, 47, 0);
TimeSpan travelTime = arrival - departure;
Console.WriteLine("{0} - {1} = {2}", arrival, departure, travelTime);
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication8
{
class Program
{
static void Main(string[] args)
{
DateTime departure = new DateTime(2014, 2, 8, 18, 32, 0);
DateTime arrival = new DateTime(2014, 2, 9, 22, 47, 0);
TimeSpan travelTime = arrival - departure;
Console.WriteLine("{0} - {1} = {2}", arrival, departure, travelTime);
Console.ReadKey();
}
}
}
Comments
Post a Comment