Пример #1
0
        /// <summary>
        /// Udførelse af kommandoen.
        /// </summary>
        /// <param name="command">Command til tilføjelse af et postnummer.</param>
        /// <returns>Oprettet postnummer.</returns>
        public PostnummerView Execute(PostnummerAddCommand command)
        {
            if (command == null)
            {
                throw new ArgumentNullException("command");
            }

            var postnummer = new Postnummer(command.Landekode, command.Postnummer, command.Bynavn);

            var oprettetPostnummer = _adresseRepository.PostnummerAdd(postnummer.Landekode, postnummer.Postnr,
                                                                      postnummer.By);

            return(_objectMapper.Map <Postnummer, PostnummerView>(oprettetPostnummer));
        }