Exemplo n.º 1
0
        public ActionResult Index()
        {
            var filesCollection = obj.GetFiles();

            ViewBag.A = filesCollection;
            return(View());
        }
Exemplo n.º 2
0
        public ActionResult Create()
        {
            if (Session["USER"] != null)
            {
                if (lecturer.Priority >= 7)
                {
                    DownloadFile        download = new DownloadFile();
                    List <DownloadFile> files    = download.GetFiles();
                    return(View(files));
                }
            }

            return(RedirectToAction("Index", "Home"));
        }
Exemplo n.º 3
0
        public ActionResult Download(int?DownloadId, Project project)
        {
            string contentType = string.Empty;

            if (Session["Position"].Equals("CEO"))
            {
                int    CurrentFileID   = Convert.ToInt32(Session["ProjId"]);
                var    filesCol        = obj.GetFiles();
                String CurrentFileName = "";
                //string CurrentFileName = (from f in filesCol
                //                          where f.ProjectId == CurrentFileID
                //                          select f.FilePath).First();
                foreach (var item in filesCol)
                {
                    if (item.FilePath.Equals(Session["Path"]))
                    {
                        CurrentFileName = item.FilePath;
                    }

                    if (CurrentFileName.Contains(".pdf"))
                    {
                        contentType = "application/pdf";
                    }

                    else if (CurrentFileName.Contains(".docx"))
                    {
                        contentType = "application/docx";
                    }
                }
                String fileName = Path.GetFileName(CurrentFileName);
                return(File(CurrentFileName, contentType, fileName));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
Exemplo n.º 4
0
        public ActionResult Index()
        {
            var fileCollection = obj.GetFiles();

            return(View(fileCollection));
        }