Exemplo n.º 1
0
        public async Task <ActionResult> MediaItem(int id)
        {
            CheckForReadOnly();

            if (ModelState.IsValid)
            {
                var user = new UserManager().GetUser((int)UserID);
                var htmlInputProvider = new OCM.API.InputProviders.HTMLFormInputProvider();

                if (user != null)
                {
                    var mediaItem = new MediaItem();
                    var tempPath  = System.IO.Path.GetTempPath() + "\\_ocm";
                    if (!System.IO.Directory.Exists(tempPath))
                    {
                        System.IO.Directory.CreateDirectory(tempPath);
                    }
                    bool uploaded = await htmlInputProvider.ProcessMediaItemSubmission(tempPath, HttpContext, mediaItem, user.ID).ConfigureAwait(true);

                    ViewBag.PoiId = id;

                    if (uploaded)
                    {
                        ViewBag.UploadCompleted = true;
                    }
                }
            }

            return(View("AddMediaItem"));
        }
Exemplo n.º 2
0
        public ActionResult AddMediaItem(int id, FormCollection collection)
        {
            var user = new UserManager().GetUser((int)Session["UserID"]);
            var htmlInputProvider = new OCM.API.InputProviders.HTMLFormInputProvider();

            if (user != null)
            {
                var mediaItem = new MediaItem();
                bool uploaded = htmlInputProvider.ProcessMediaItemSubmission(this.HttpContext.ApplicationInstance.Context, ref mediaItem, user.ID);
                ViewBag.PoiId = id;
                ViewBag.UploadCompleted = true;
                return View();
            }

            return View();
        }
Exemplo n.º 3
0
        public ActionResult AddMediaItem(int id, FormCollection collection)
        {
            var user = new UserManager().GetUser((int)Session["UserID"]);
            var htmlInputProvider = new OCM.API.InputProviders.HTMLFormInputProvider();

            if (user != null)
            {
                var  mediaItem = new MediaItem();
                bool uploaded  = htmlInputProvider.ProcessMediaItemSubmission(this.HttpContext.ApplicationInstance.Context, ref mediaItem, user.ID);
                ViewBag.PoiId           = id;
                ViewBag.UploadCompleted = true;
                return(View());
            }

            return(View());
        }