public CheckoutController(IBucketProvider bucketProvider, IHostingEnvironment env, IEmailSender emailSender, Configuration configuration) { // singleton that is the DB bucket similar to MySQL _checkoutBucket = bucketProvider.GetBucket("Checkout"); _userInfoBucket = bucketProvider.GetBucket("UserInfo"); _env = env; _emailSender = emailSender; this.configuration = configuration; }
//Upon user selected options, display appropriate data. public IActionResult GetState(MerchandiseViewModel model) { model.countries = _countries; model.cards = _cards; model.networks = _networks; model.SelectedCountry = (from c in model.countries where c.Value == model.SelectedCountryId.ToString() select new Country { CountryId = int.Parse(c.Value), CountryName = c.Text }).FirstOrDefault(); model.SelectedCard = (from d in model.cards where d.Value == model.SelectedCardId.ToString() select new Card { CardId = int.Parse(d.Value), CardLetter = d.Text }).FirstOrDefault(); model.SelectedNetwork = (from n in model.networks where n.Value == model.SelectedNetworkId.ToString() select new Network { NetworkId = int.Parse(n.Value), NetworkName = n.Text }).FirstOrDefault(); NetworkId = model.SelectedNetworkId; CompanyId = model.SelectedCountryId; CardId = model.SelectedCardId; string countryName = FindCountryName(model.SelectedCountry.CountryId); string cardLetter = GetCard(model.SelectedCard.CardId); int countryCode = FindCountryCode(model.SelectedCountry.CountryId); var bucket = _bucketProvider.GetBucket(countryName); var n1ql = @"SELECT g.*, META(g).id FROM `" + countryName + "` g " + "WHERE g.companyId = " + countryCode + " " + "AND g.showCd = '" + cardLetter + "' " + "AND g.networkId = " + model.SelectedNetwork.NetworkId + " " + "LIMIT 20;"; var query = QueryRequest.Create(n1ql); var results = bucket.Query <Merchandise>(query); try { model.merchandise = results.Rows; } catch (global::System.Exception) { throw; } return(View(model)); }
public IActionResult GetUSA() { var bucket = _bucketProvider.GetBucket("MerchUSA"); var n1ql = @"SELECT g.*, META(g).id FROM `MerchUSA` g WHERE g.companyId = 0;"; var query = QueryRequest.Create(n1ql); var results = bucket.Query <Merchandise>(query); return(Ok(results.Rows)); }
public async Task <IActionResult> GetAirlines() { var bucket = _bucketProvider.GetBucket("travel-sample"); var context = new BucketContext(bucket); var query = from p in context.Query <Airline>() orderby p.Name select p; var result = await query.ExecuteAsync(); return(Ok(result.Select(p => _mapper.Map <AirlineDto>(p)))); }
public Repository(IBucketProvider bucketProvider, ICluster clustur) { string name = typeof(Type) .GetAttributeValue((BucketNameAttribute dna) => dna.Name); if (string.IsNullOrEmpty(name)) { throw new BucketNotFoundException("BucketName Eklememiş"); } clustur.Authenticate("Administrator", "Qn4j123"); _clusterManager = clustur.CreateManager(); //burda kaldım clustur oluşturmuyor var bucketList = _clusterManager.ListBuckets(); if (bucketList.Success && !bucketList.Value.Any(x => x.Name == name)) { var bucketResult = CreateBucket(name); if (!bucketResult.Item1) { throw new BucketNotFoundException($"Bucket Oluşturulken hata alındı {bucketResult.Item2}"); } else { ExecQueryReturnList($"CREATE PRIMARY INDEX `{name}_primary_index` ON `{name}`"); } } _bucket = bucketProvider.GetBucket(name); }
public CarPriceController(ISlowLegacyService service, IBucketProvider bucketProvider) { _service = service; // this is only in the homecontroller for GetCachedItemsFromCouchbase // which is purely for demonstration/presentation purposes _bucket = bucketProvider.GetBucket("mycache"); }
public async Task <IActionResult> RequestWithLock(int requester) { var bucket = _bucketProvider.GetBucket("default"); _logger.LogInformation("Starting requester {requester}", requester); try { var startTime = DateTime.Now; // Retry policy will try 10 times to get the lock, and will wait 1 second between attempts // Lock will be held for 2 seconds if not renewed using (var mutex = await RetryPolicy.ExecuteAsync(() => bucket.RequestMutexAsync("my_lock_name", TimeSpan.FromSeconds(2)))) { // Will renew the lock every second, up to a maximum of 15 seconds, so long as the process keeps running mutex.AutoRenew(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(15)); var lockTime = DateTime.Now; await Task.Delay(5000); return(View(new RequestWithLockModel { WasLocked = true, LockDelayTime = lockTime - startTime, LockHoldTime = DateTime.Now - lockTime })); // Lock will be released once we exit the using statement, and auto renew will cease } } catch (CouchbaseLockUnavailableException) { return(View(new RequestWithLockModel { WasLocked = false })); } }
public SlowLegacyService(IBucketProvider bucketProvider) { _bucket = bucketProvider.GetBucket("mycache"); }
public BasketDiscController(IBucketProvider bucketProvider) { // singleton that is the DB bucket similar to MySQL _bucket = bucketProvider.GetBucket("Basket"); }
public HomeController(IBucketProvider bucketProvider) { _bucket = bucketProvider.GetBucket("travel-sample"); }
public GeoSpatialController(IBucketProvider bucketProvider) { _bucket = bucketProvider.GetBucket("travel-sample"); }
public LoyaltyCsvImportService(IBucketProvider bucketProvider, ILogger <LoyaltyCsvImportService> logger) { _logger = logger; _bucket = bucketProvider.GetBucket("staging"); }
public BookRepository(IBucketProvider bucketProvider) { _bucket = bucketProvider.GetBucket("Books", "12345678"); }
public TicketController(IBucketProvider bucketProvider) { _bucket = bucketProvider.GetBucket("tickets"); }
public HomeController(ILogger <HomeController> logger, IBucketProvider bucketProvider) { _logger = logger; _bucket = bucketProvider.GetBucket("hellomicroservice"); }
public CouchbaseMessageService(IBucketProvider bucketProvider) { _bucket = bucketProvider.GetBucket("CarMessengerBucket"); }
public UpcomingEventsController(IBucketProvider bucketProvider) { _bucket = bucketProvider.GetBucket("events"); }
public PeopleRepository(IBucketProvider provider) { this.peopleBucket = provider.GetBucket("people-sample"); }
public UserController(IBucketProvider bucketProvider) { _bucket = bucketProvider.GetBucket("default"); }
public ContainerRepository(IBucketProvider bucketProvider) { _bucket = bucketProvider.GetBucket("sitadb"); }
public SportController(IBucketProvider bucketProvider, ILogger <ClientController> logger) { _bucket = bucketProvider.GetBucket("feeds"); }
public AirportController(IBucketProvider bucketProvider) { _bucket = bucketProvider.GetBucket("travel-sample", "Administrator"); }
public UserProfileController(ILogger <UserProfileController> logger, IBucketProvider bucket, IMediator mediator) { _logger = logger; _mediator = mediator; _bucket = bucket.GetBucket("usereventsource"); }
public SessionMetricsRepository(IBucketProvider bucketProvider) { this._bucket = bucketProvider.GetBucket("ViajaNet"); }
public UserRepository(IBucketProvider bucketProvider) { _bucket = bucketProvider.GetBucket("user_profile"); _bucketContext = new BucketContext(_bucket); }
//private readonly IBucketContext _ctx; public PersonController(IBucketProvider bucketProvider) { _bucket = bucketProvider.GetBucket("workshop"); //_ctx = context; }
public HomeController(IBucketProvider bucketProvider) { _bucket = bucketProvider.GetBucket("default", "password"); }
public LandmarkController(IBucketProvider bucket) { this.bucket = bucket.GetBucket("travel-sample"); }
public SocialMediaRequestHandler(IBucketProvider bucketProvider) { _bucket = bucketProvider.GetBucket("usereventsource"); }
public WeatherForecastController(ILogger <WeatherForecastController> logger, IBucketProvider bucketProvider) { _logger = logger; _bucket = bucketProvider.GetBucket("jul"); }