示例#1
0
        private void CreatePet(Message message)
        {
            var bytes = message.Body;
            var json  = Encoding.UTF8.GetString(bytes);
            var cmd   = JsonConvert.DeserializeObject <CreatePetCommand>(json);

            Pet pet = new Pet
            {
                Id          = cmd.NewPetId,
                OwnerId     = cmd.OwnerId,
                AnimalId    = cmd.AnimalId,
                Name        = cmd.PetName,
                Description = cmd.PetDescription,
            };

            _petsRepository.Add(pet);
        }