Esempio n. 1
0
        // GET: Emp
        public ActionResult Index()
        {
            //==> using Linq
            //return View(db.Emps.Select(Emp => new EmpViewModel
            //{
            //    Age = Emp.Age,
            //    Country = Emp.Country,
            //    ID = Emp.ID,
            //    LastModified = Emp.LastModified,
            //    Name = Emp.Name,
            //    Profile = Emp.Profile
            //}).ToList());

            //==>Calling StoreProcedure
            var data = db.GetAllEmployees().Select(Emp => new EmpViewModel
            {
                Age          = Emp.Age,
                Country      = Emp.Country,
                ID           = Emp.ID,
                LastModified = Emp.LastModified,
                Name         = Emp.Name,
                Profile      = Emp.Profile
            }).ToList();

            return(View(data));
        }