Beispiel #1
0
        public IActionResult CreateBizProperties(BizPropertiesViewModel BizPropsVM, int biz_id)
        {
            if (checkLogStatus() == false)
            {
                return(RedirectToAction("Index", "Home"));
            }

            if (ModelState.IsValid)
            {
                // Confirm the business does not already have a 1:1 properties record
                try
                {
                    BusProperties CheckProperties = _context.Properties.SingleOrDefault(biz => biz.BusinessId == biz_id);
                    if (CheckProperties != null)
                    {
                        // the business already has an existing properties record;
                        // update the record instead of creating a new one
                        BusProperties updateBizProperty = new BusProperties(BizPropsVM);
                        CheckProperties.alcohol          = updateBizProperty.alcohol;
                        CheckProperties.ambience         = updateBizProperty.ambience;
                        CheckProperties.bikeparking      = updateBizProperty.bikeparking;
                        CheckProperties.ByApointOnly     = updateBizProperty.ByApointOnly;
                        CheckProperties.caters           = updateBizProperty.caters;
                        CheckProperties.creditcards      = updateBizProperty.creditcards;
                        CheckProperties.delivery         = updateBizProperty.delivery;
                        CheckProperties.goodforTimeOfDay = updateBizProperty.goodforTimeOfDay;
                        CheckProperties.groupfriendly    = updateBizProperty.groupfriendly;
                        CheckProperties.kidfriendly      = updateBizProperty.kidfriendly;
                        CheckProperties.outdoor          = updateBizProperty.outdoor;
                        CheckProperties.parkwhere        = updateBizProperty.parkwhere;
                        CheckProperties.price            = updateBizProperty.price;
                        CheckProperties.reservations     = updateBizProperty.reservations;
                        CheckProperties.takeout          = updateBizProperty.takeout;
                        CheckProperties.waiter           = updateBizProperty.waiter;
                        CheckProperties.wheelchair       = updateBizProperty.wheelchair;
                        CheckProperties.wifi             = updateBizProperty.wifi;
                        CheckProperties.UpdatedAt        = DateTime.Now;
                        _context.SaveChanges();

                        return(RedirectToAction("NewBizHours", new { biz_id = biz_id }));
                    }
                }
                catch (Exception ex)
                {
                    // there were not any existing businesses with the same name
                    // proceed with code
                }
                BusProperties newBizProperty = new BusProperties(BizPropsVM);
                newBizProperty.BusinessId = biz_id;
                _context.Properties.Add(newBizProperty);
                _context.SaveChanges();
            }
            else
            {
                return(RedirectToAction("NewBizProperties"));
            }
            return(RedirectToAction("NewBizHours", new { biz_id = biz_id }));
        }
Beispiel #2
0
        public AzureQueueClient(BusProperties busProperties, QueueClient queueClient)
        {
            _queueClient = queueClient;
            var connectionString = busProperties.ConnectionString ?? throw new ArgumentNullException(nameof(busProperties.ConnectionString));
            var queueName        = busProperties.QueueName ?? throw new ArgumentNullException(nameof(busProperties.QueueName));

            _queueClient = new QueueClient(connectionString, queueName);
            _queueClient.CreateIfNotExists();
        }
 public BusClient(BusProperties busProperties)
 {
     if (busProperties.ConnectionString == null)
     {
         throw new ArgumentNullException(nameof(busProperties.ConnectionString));
     }
     if (busProperties.EventTopicName == null)
     {
         throw new ArgumentNullException(nameof(busProperties.EventTopicName));
     }
     _busTopicConnections = new BusTopicConnections(busProperties.ConnectionString, busProperties.EventTopicName);
 }
 public ServiceBusEventSubscriber(
     BusProperties busProperties,
     ILogger <ServiceBusEventSubscriber> logger,
     IBusSubscriptionsManager busSubscriptionsManager,
     IIntegrationEventDispatcher eventDispatcher)
 {
     _busProperties          = busProperties;
     _logger                 = logger ?? throw new ArgumentNullException(nameof(logger));
     _subscriptionClient     = new SubscriptionClient(busProperties.ConnectionString, busProperties.EventTopicName, busProperties.EventSubscriptionName);
     _busSubscriptionManager = busSubscriptionsManager ?? throw new ArgumentNullException(nameof(busSubscriptionsManager));
     _eventDispatcher        = eventDispatcher ?? throw new ArgumentNullException(nameof(eventDispatcher));
 }