public void Handle(CreatePropertyCommand command)
        {
            var property = new Models.Property
            {
                PropertyType     = command.PropertyType,
                StreetName       = command.StreetName,
                Description      = command.Description,
                NumberOfBedrooms = command.NumberOfBedrooms
            };

            property.SellerUserId = command.SellerUserId;

            this._context.Properties.Add(property);

            this._context.SaveChanges();
        }
        public void Handle(CreatePropertyCommand command)
        {
            var property = new Models.Property
            {
                PropertyType     = command.PropertyType,
                StreetName       = command.StreetName,
                Description      = command.Description,
                NumberOfBedrooms = command.NumberOfBedrooms,
                IsListedForSale  = true //Bug: Defaulting Property for sale to false
            };

            property.SellerUserId = command.SellerUserId;

            _context.Properties.Add(property);

            _context.SaveChanges();
        }
Ejemplo n.º 3
0
        public void Handle(CreatePropertyCommand command)
        {
            var property = new Models.Property
            {
                PropertyType     = command.PropertyType,
                StreetName       = command.StreetName,
                Description      = command.Description,
                NumberOfBedrooms = command.NumberOfBedrooms,
                Availability     = new Availability
                {
                    StartDate       = command.Availability.StartDate,
                    StartTime       = command.Availability.StartTime,
                    EndTime         = command.Availability.EndTime,
                    ViewingDuration = command.Availability.ViewingDuration
                },
                SellerUserId = command.SellerUserId,
            };

            _context.Properties.Add(property);

            _context.SaveChanges();
        }