Ejemplo n.º 1
0
        public ActionResult AllAppointmentsForLead(int leadId)
        {
            Web.ViewModel.AllAppointmentsViewModel multipleAppointments = new AllAppointmentsViewModel();
            User assigneduser     = new User();
            User appointmentagent = new User();
            var  saUsersResult    = _UserRepository.GetAllUsersByRole(3);
            var  results          = _service.GetAllAppointmentsForLead(leadId);

            multipleAppointments.appointments = results;
            var username = HttpContext.User.Identity.Name;

            multipleAppointments.user = _UserRepository.GetUserByUsername(username);
            foreach (var appointment in multipleAppointments.appointments)
            {
                assigneduser             = _UserRepository.GetUserById(appointment.AssignedSalesAgent);
                appointment.AssignedUser = assigneduser;
                appointmentagent         = _UserRepository.GetUserById(appointment.CreatorId);
                if (appointmentagent != null)
                {
                    appointment.CreatorName = appointmentagent.UserName;
                }
            }
            // This will get all the users with role Id = 3 , the SAs
            multipleAppointments.UserNameDropdown = saUsersResult.Select(row => new SelectList(_UserRepository.GetAllUsersByRole(3)));
            multipleAppointments.SAUsersDropdown  = saUsersResult.Select(row => new SelectListItem()
            {
                Text  = row.LastName,
                Value = row.UserId.ToString(),
            });

            return(View(multipleAppointments));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> AllAppointments()
        {
            ApplicationUser user = await GetCurrentUserAsync();

            var model = new AllAppointmentsViewModel();


            model.Appointments = GetAllUserDependentAppointments(user);



            return(View(model));
        }