Esempio n. 1
0
 public DashBoardResponseViewModel DashBoard(Guid altId)
 {
     try
     {
         Contracts.DataModels.User user = AutoMapper.Mapper.Map <Contracts.DataModels.User>(_userRepository.GetByAltId(altId));
         IEnumerable <Contracts.DataModels.RecentActivity> RecentActivity = _recentActivityRepository.GetByCreatedBy(altId).OrderByDescending(o => o.CreatedUtc).Take(10);
         IEnumerable <Contracts.DataModels.Favourite>      Favourite      = _favouriteRepository.GetByCreatedBy(altId).OrderByDescending(o => o.CreatedUtc).Take(10);
         IEnumerable <Contracts.Models.Country>            country        = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.Country> >(_countryRepository.GetByAltIds(Favourite.Select(s => s.CountryAltId).Distinct()));
         return(new DashBoardResponseViewModel
         {
             RecentActivity = AutoMapper.Mapper.Map <List <RecentActivity> >(RecentActivity),
             Country = country.ToList(),
             User = AutoMapper.Mapper.Map <User>(user)
         });
     }
     catch (Exception)
     {
     }
     return(null);
 }