Beispiel #1
0
        public async Task <Trullo> CreateTrullo([Service] ITrulloRepository trulloRepository, [Service] ITopicEventSender eventSender, CreateTrulloInput trullo)
        {
            Trullo newTrullo = new Trullo
            {
                //Id = _trulloRepository.GetAll().Max(x => x.Id) + 1,
                Name        = trullo.Name,
                Description = trullo.Description,
                Capacity    = trullo.Capacity,
                Price       = trullo.Price,
                PropertyId  = trullo.PropertyId
            };

            var createdTrullo = await trulloRepository.Create(newTrullo);

            await eventSender.SendAsync("TrulloCreated", createdTrullo);

            return(createdTrullo);
        }
        public async Task <Trullo> CreateTrullo([Service] ITrulloRepository trulloRepository, [Service] ITopicEventSender eventSender, CreateTrulloInput trullo)
        {
            Trullo newTrullo = new Trullo
            {
                _id         = ObjectId.GenerateNewId().ToString(),
                Name        = trullo.Name,
                Description = trullo.Description,
                Capacity    = trullo.Capacity,
                Price       = trullo.Price,
                Property_id = trullo.PropertyId
            };

            var createdTrullo = await trulloRepository.Create(newTrullo);

            await eventSender.SendAsync("TrulloCreated", createdTrullo);

            return(createdTrullo);
        }