Esempio n. 1
0
        private void SaveEventAmentity(SaveEventCommand command, long id)
        {
            var entries = _eventAmenityRepository.GetByEventId(id);

            foreach (var entry in entries)
            {
                _eventAmenityRepository.Delete(entry);
            }
            if (command.AmenityIds != "")
            {
                var amenities = command.AmenityIds.Split(',');
                foreach (var amenity in amenities)
                {
                    var eventAmenity = new EventAmenity
                    {
                        AmenityId   = Convert.ToInt32(amenity),
                        Description = command.Description ?? "",
                        EventId     = id,
                        IsEnabled   = command.IsEnabled,
                        UpdatedBy   = command.ModifiedBy,
                        UpdatedUtc  = DateTime.UtcNow,
                        CreatedBy   = command.ModifiedBy,
                        CreatedUtc  = DateTime.UtcNow,
                        ModifiedBy  = command.ModifiedBy,
                        Id          = 0
                    };
                    _eventAmenityRepository.Save(eventAmenity);
                }
            }
        }
Esempio n. 2
0
        protected override async Task Handle(EventAmenityCommand command)
        {
            var entries = _eventAmenityRepository.GetByEventId(command.EventId);

            foreach (var entry in entries)
            {
                _eventAmenityRepository.Delete(entry);
            }
            var eventAmenityresult = _eventAmenityRepository.Get(command.Id);
            var eventAmenity       = new EventAmenity
            {
                AmenityId   = command.AmenityId,
                Description = command.Description,
                EventId     = command.EventId,
                IsEnabled   = command.IsEnabled,
                UpdatedBy   = command.ModifiedBy,
                UpdatedUtc  = DateTime.UtcNow,
                CreatedBy   = command.ModifiedBy,
                CreatedUtc  = DateTime.UtcNow,
                ModifiedBy  = command.ModifiedBy,
                Id          = command.Id
            };

            _eventAmenityRepository.Save(eventAmenity);
        }