Esempio n. 1
0
        // Delete file from the server
        private void DeleteFile(HttpContext context)
        {
            if (context.Request["f"] == null)
            {
                return;
            }

            var filePath = StorageRoot + context.Request["f"];

            GerenciarMidia.DeletarMidiaDirectory(filePath);

            var idMidia = int.Parse(Path.GetFileNameWithoutExtension(filePath).Split('_').Last());

            GerenciarMidia.DeletarMidia(idMidia);
        }
Esempio n. 2
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Midia midia = _midiaDao.Get((int)id);

            if (midia == null)
            {
                return(HttpNotFound());
            }
            _midiaDao.Delete(midia);

            GerenciarMidia.DeletarMidiaDirectory(string.Format("{0}{1}", midia.Nome, midia.Extensao), midia.IdEmpresa);

            return(RedirectToAction("Index"));
        }