Exemplo n.º 1
0
        // GET: SocialEvents
        public ActionResult Index()
        {
            var raceEventList = new List <SocialEventIndexViewModel>();
            //return View(raceEventList);

            var mapperConfig = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <SocialEventDTO, SocialEventIndexViewModel>();
                cfg.CreateMap <RegattaDTO, RegattaDisplayViewModel>();
            });

            using (var raceEventService = new SocialEventService())
            {
                try
                {
                    var allRaceEventDto = raceEventService.EagerDisconnectedService.FindByInclude(x => x.Active, r => r.Regatta);
                    if (allRaceEventDto == null)
                    {
                        throw new NullReferenceException();
                    }
                    if (allRaceEventDto.Any())
                    {
                        var mapper = mapperConfig.CreateMapper();
                        mapper.Map(allRaceEventDto, raceEventList);
                        return(View(raceEventList.OrderBy(r => r.Name)));
                    }
                    throw new Exception("Could not find any SocialEvents.");
                }
                catch (Exception e)
                {
                    TempData["ResultMessage"] = e.Message;
                    return(View("Error"));
                }
            }
        }
Exemplo n.º 2
0
 static ServiceLocator()
 {
     AddressService        = new AddressService();
     BoatService           = new BoatService();
     ClubService           = new ClubService();
     UserService           = new UserService();
     EntryService          = new EntryService();
     RaceEventService      = new RaceEventService();
     RegattaService        = new RegattaService();
     SocialEventService    = new SocialEventService();
     TeamService           = new TeamService();
     EmailService          = new EmailService();
     PhoneNumberService    = new PhoneNumberService();
     RegisteredUserService = new RegisteredUserService();
     ResultService         = new ResultService();
     UserRoleService       = new UserRoleService();
     ClubsUsersUserRolesJunctionsService    = new Clubs_Users_UserRoles_JunctionsService();
     RegattasUsersUserRolesJunctionsService = new Regattas_Users_UserRoles_JunctionsService();
     RegisteredUserSocialEventService       = new RegisteredUser_SocialEventService();
     TeamRaceEventService      = new Team_RaceEventService();
     TeamRegisteredUserService = new Team_RegisteredUserService();
     BoatService = new BoatService();
     SocialEventsUsersUserRolesJunctionsService = new SocialEvents_Users_UserRoles_JunctionsService();
     RaceEventsUsersUserRolesJunctionsService   = new RaceEvents_Users_UserRoles_JunctionsService();
     ClubsEmailsService       = new ClubsEmailsService();
     ClubsPhoneNumbersService = new ClubsPhoneNumbersService();
 }