Esempio n. 1
0
        public ActionResult Details(int id)
        {
            var projectManager   = new ProjectManager();
            var timesheetManager = new TimesheetManager();

            ClientDetails cDetails = new ClientDetails();

            cDetails.Client      = Mapper.Map <Models.Client.Client>(_clientManager.GetClient(id));
            cDetails.ProjectList = projectManager.GetProjects(id)
                                   .Select(i => Mapper.Map <Models.Project.Project>(i));

            cDetails.TotalHours = 0;
            foreach (var project in cDetails.ProjectList)
            {
                var timeEntries = timesheetManager.GetTimeEntries(project.ProjectId);
                cDetails.TotalHours += (float)timeEntries.Sum(i => i.sunday + i.monday + i.tuesday + i.wednesday + i.thursday + i.friday + i.saturday);
            }

            return(View(cDetails));
        }