コード例 #1
0
        private void SetStreamToCouchDb(StreamDocModel value)
        {
            var client = new RestClient(string.Format("http://mfranc.cloudant.com/dotnetconf/_design/update_stream/_update/in-place-query/current_stream?field=stream&value={0}", value.stream));
            var request = new RestRequest(Method.PUT);

            var response = client.Execute(request);
        }
コード例 #2
0
        private void SetStreamToCouchDb(StreamDocModel value)
        {
            var storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["AzureStorage"]);

            var blobClient = storageAccount.CreateCloudBlobClient();

            var container = blobClient.GetContainerReference(ConfigurationManager.AppSettings["ContainerName"]);

            container.CreateIfNotExists();
            var currentStream = container.GetBlockBlobReference("CurrentStream");

            currentStream.UploadText(Newtonsoft.Json.JsonConvert.SerializeObject(value));
        }
コード例 #3
0
        public ActionResult UpdateStream(string newStream, string password, string streamType)
        {
            if (newStream.IndexOf("youtube", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (newStream.Contains("watch?v="))
            {
                newStream = newStream.Replace("watch?v=", "embed/");
            }

            if (PasswordCheck.HashVerified(password))
            {
                CurrentStream = new StreamDocModel {
                    stream = newStream, type = streamType
                };
                return(new HttpStatusCodeResult(HttpStatusCode.OK));
            }

            return(new HttpUnauthorizedResult("Invalid password"));
        }
コード例 #4
0
 public void UpdateStream(string newStream, string password, string streamType)
 {
     if (PasswordCheck.HashVerified(password))
     {
         CurrentStream = new StreamDocModel {stream = newStream, type = streamType};
     }
 }