// GET: /Subscribe/ public async Task<ActionResult> Index(string id, string listName) { // We get to this method when they click on the Confirm link in the // email that's sent to them after the subscribe service method is called. TableRequestOptions reqOptions = new TableRequestOptions() { MaximumExecutionTime = TimeSpan.FromSeconds(1.5), RetryPolicy = new LinearRetry(TimeSpan.FromSeconds(3), 3) }; string filter = TableQuery.CombineFilters( TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, listName), TableOperators.And, TableQuery.GenerateFilterCondition("SubscriberGUID", QueryComparisons.Equal, id)); var query = new TableQuery<Subscriber>().Where(filter); TableContinuationToken token = null; OperationContext ctx = new OperationContext() { ClientRequestID = "" }; TableQuerySegment<Subscriber> currentSegment = null; currentSegment = await mailingListTable.ExecuteQuerySegmentedAsync(query, token, reqOptions, ctx); var subscriber = currentSegment.Results.ToList().Single(); //subscriberTableRow.Status = "Verified"; subscriber.Verified = true; var replaceOperation = TableOperation.Merge(subscriber); mailingListTable.Execute(replaceOperation); var newSubscriber = new SubscribeVM(); newSubscriber.EmailAddress = subscriber.EmailAddress; var mailingList = await FindRowAsync(subscriber.ListName, "mailinglist"); newSubscriber.ListDescription = mailingList.Description; return View(newSubscriber); }
// GET: /Subscribe/ public ActionResult Index(string id, string listName) { // We get to this method when they click on the Confirm link in the // email that's sent to them after the subscribe service method is called. string filter = TableQuery.CombineFilters( TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, listName), TableOperators.And, TableQuery.GenerateFilterCondition("SubscriberGUID", QueryComparisons.Equal, id)); var query = new TableQuery<Subscriber>().Where(filter); var subscriber = mailingListTable.ExecuteQuery(query).ToList().Single(); //subscriberTableRow.Status = "Verified"; subscriber.Verified = true; var replaceOperation = TableOperation.Merge(subscriber); mailingListTable.Execute(replaceOperation); var newSubscriber = new SubscribeVM(); newSubscriber.EmailAddress = subscriber.EmailAddress; newSubscriber.ListDescription = FindRow(subscriber.ListName, "mailinglist").Description; return View(newSubscriber); }