Пример #1
0
        public Guid Create(Guid userId, Location location, string description)
        {
            Guard.AgainstNullOrEmpty(description);
            Guard.AgainstNullOrEmpty(userId);


            // todo: syntactic validation of the description
            // is it positive
            // does it contain enough meaning

            // todo: ValidateLocation

            var propertyId = Guid.NewGuid();

            _propertiesRepository.Add(new PropertyDao
            {
                Location = Mapper.Map <LocationDao>(location),

                Description = description,
                Id          = propertyId,
                Status      = (byte)PropertyStatus.Available,
                UserId      = userId
            });

            _propertiesRepository.Save();

            _eventBus.Publish(new PropertyCreated(userId, propertyId));

            return(propertyId);
        }