Пример #1
0
        //
        // GET: /CAEmployee/
        public ActionResult Index()
        {
            CommunityAssistEntities cad = new CommunityAssistEntities();
            var doners = from d in cad.Donations
                            orderby d.Person.PersonLastName
                            select new
                            {
                                d.Person.PersonLastName,
                                d.Person.PersonFirstName,
                                d.Person.Donations,
                                d.DonationAmount,
                                d.Person.PersonUsername

                            };
            List<CADoner> donerList = new List<CADoner>();
            foreach (var x in doners)
            {
                CADoner don = new CADoner();
                don.LastName = x.PersonLastName;
                don.FirstName = x.PersonFirstName;
                don.Email = x.PersonUsername;
                don.Donation = x.DonationAmount.ToString();

                donerList.Add(don);
            }

            return View(donerList);
        }
Пример #2
0
        //
        // GET: /CAEmployee/
        public ActionResult Index()
        {
            CommunityAssistEntities cae = new CommunityAssistEntities();
            var employees = from e in cae.EmployeeJobTitles
                            orderby e.Employee.Person.PersonLastName
                            select new
                            {
                                e.Employee.Person.PersonLastName,
                                e.Employee.Person.PersonFirstName,
                                e.Employee.Person.PersonUsername,
                                e.Employee.EmployeeHireDate,
                                e.Jobtitle.JobTitleName,
                                e.Employee.EmployeeStatus
                            };
            List<CAEmployee> employeeList = new List<CAEmployee>();
            foreach (var x in employees)
            {
                CAEmployee emp = new CAEmployee();
                emp.LastName = x.PersonLastName;
                emp.FirstName = x.PersonFirstName;
                emp.Email = x.PersonUsername;
                emp.HireDate = x.EmployeeHireDate.ToString();
                emp.JobTitle = x.JobTitleName;
                emp.Status = x.EmployeeStatus;

                employeeList.Add(emp);
            }

            return View(employeeList);
        }