Esempio n. 1
0
 public EventCategoryQueryResult Handle(EventCategoryQuery query)
 {
     if (query.Id == 0)
     {
         if (!string.IsNullOrWhiteSpace(query.Slug))
         {
             var eventResult = _eventCategoryRepository.GetBySlug(query.Slug);
             List<FIL.Contracts.Models.EventCategory> EventCategories = new List<Contracts.Models.EventCategory>();
             EventCategories.Add(AutoMapper.Mapper.Map<FIL.Contracts.Models.EventCategory>(eventResult));
             return new EventCategoryQueryResult
             {
                 EventCategories = EventCategories
             };
         }
         else
         {
             var eventResult = _eventCategoryRepository.GetActiveEventCategory().OrderBy(o => o.Order);
             return new EventCategoryQueryResult
             {
                 EventCategories = AutoMapper.Mapper.Map<List<FIL.Contracts.Models.EventCategory>>(eventResult)
             };
         }
     }
     else
     {
         var eventResult = _eventCategoryRepository.Get(query.Id);
         List<FIL.Contracts.Models.EventCategory> EventCategories = new List<Contracts.Models.EventCategory>();
         EventCategories.Add(AutoMapper.Mapper.Map<FIL.Contracts.Models.EventCategory>(eventResult));
         return new EventCategoryQueryResult
         {
             EventCategories = EventCategories
         };
     }
 }
        public EventCreationCategoryQueryResult Handle(EventCreationCategoryQuery query)
        {
            var eventResult = _eventCategoryRepository.GetActiveEventCategory().OrderBy(o => o.Order);

            return(new EventCreationCategoryQueryResult
            {
                EventCategories = AutoMapper.Mapper.Map <List <FIL.Contracts.Models.EventCategory> >(eventResult)
            });
        }