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")); }