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); }
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)); }
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")); }
public void UpdateStream(string newStream, string password, string streamType) { if (PasswordCheck.HashVerified(password)) { CurrentStream = new StreamDocModel {stream = newStream, type = streamType}; } }