コード例 #1
0
        public HttpResponseMessage AddMovie(movieDetailsList obj)
        {
            bool status = false;
            HttpResponseMessage response;

            try
            {
                status = objReg.AdminAddMovie(obj);
                if (status == true)
                {
                    var showmessage = "Movie Saved Successfully.";

                    return(Request.CreateResponse(HttpStatusCode.OK, showmessage));
                }
                else
                {
                    var showmessage = "Movie Not Saved Please try again.";

                    return(Request.CreateResponse(HttpStatusCode.BadRequest, showmessage));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
 public string AddMovieindb(movieDetailsList obj)
 {
     using (HttpClient client = new HttpClient())
     {
         string stringData            = JsonConvert.SerializeObject(obj);
         var    contentData           = new StringContent(stringData, System.Text.Encoding.UTF8, "application/json");
         HttpResponseMessage response = client.PostAsync(webapiurl + "/Admin/AddMovie", contentData).Result;
         var list = response.Content.ReadAsStringAsync().Result;
         return(list);
     }
 }
コード例 #3
0
        public ActionResult AddMovie2(FormCollection form)
        {
            string Screen      = form["Screen"];
            string Movie       = form["Movie"];
            string From        = form["From"];
            string RunningUpto = form["RunningUpto"];
            string filePath    = string.Empty;
            string url         = string.Empty;

            if (Request.Files.Count > 0)
            {
                int i = 0;
                CloudStorageAccount cloudStorageAccount = DropDown.GetConnectionString();
                CloudBlobClient     cloudBlobClient     = cloudStorageAccount.CreateCloudBlobClient();
                CloudBlobContainer  cloudBlobContainer  = cloudBlobClient.GetContainerReference(ConfigurationManager.AppSettings["ContainerName"]);
                cloudBlobContainer.CreateIfNotExists();
                foreach (string files in Request.Files)
                {
                    string         fileName       = Path.GetFileName(Request.Files[i].FileName);
                    CloudBlockBlob azureBlockBlob = cloudBlobContainer.GetBlockBlobReference(fileName);
                    azureBlockBlob.UploadFromStream(Request.Files[i].InputStream);

                    //var postedFile = Request.Files[file];
                    //filePath = Server.MapPath("~/Content/images/" + postedFile.FileName);
                    //postedFile.SaveAs(filePath);
                    i++;
                    url = azureBlockBlob.Uri.ToString();
                }
            }
            //int str= filePath.IndexOf("Content");
            //int str1 = filePath.Length;
            string           s   = @"\Content\images\EN.jpg";//filePath.Substring(str, str1-str);
            movieDetailsList obj = new movieDetailsList();

            obj.Screen      = Screen;
            obj.Movie       = Movie;
            obj.From        = Convert.ToDateTime(From);
            obj.RunningUpto = Convert.ToDateTime(RunningUpto);
            obj.path        = url;
            var res = AddMovieindb(obj);

            if (res.Contains("Successfully"))
            {
                ViewBag.Message = res;
            }
            ViewBag.ScreenList = DropDown.ScreenList();
            return(View());
        }
コード例 #4
0
        public ActionResult AddMovie(FormCollection form)
        {
            string Screen      = form["Screen"];
            string Movie       = form["Movie"];
            string From        = form["From"];
            string RunningUpto = form["RunningUpto"];
            string filePath    = string.Empty;
            string url         = string.Empty;

            if (Request.Files.Count > 0)
            {
                int i = 0;
                CloudStorageAccount cloudStorageAccount = DropDown.GetConnectionString();
                CloudBlobClient     cloudBlobClient     = cloudStorageAccount.CreateCloudBlobClient();
                CloudBlobContainer  cloudBlobContainer  = cloudBlobClient.GetContainerReference(ConfigurationManager.AppSettings["ContainerName"]);
                cloudBlobContainer.CreateIfNotExists();
                foreach (string files in Request.Files)
                {
                    string         fileName       = Path.GetFileName(Request.Files[i].FileName);
                    CloudBlockBlob azureBlockBlob = cloudBlobContainer.GetBlockBlobReference(fileName);
                    azureBlockBlob.UploadFromStream(Request.Files[i].InputStream);

                    i++;
                    url = azureBlockBlob.Uri.ToString();
                }
            }


            movieDetailsList obj = new movieDetailsList();

            obj.Screen      = Screen;
            obj.Movie       = Movie;
            obj.From        = Convert.ToDateTime(From);
            obj.RunningUpto = Convert.ToDateTime(RunningUpto);
            obj.path        = url;
            var res = AddMoviemethod(obj);

            if (res.Contains("Successfully"))
            {
                ViewBag.Message = res;
            }
            ViewBag.ScreenList = DropDown.ScreenList();
            return(View());
        }
コード例 #5
0
 public string AddMoviemethod(movieDetailsList obj)
 {
     return(HttpCalls.Httpclientcall(obj, "Admin", "AddMovie"));
 }