示例#1
0
        //
        // GET: /Upload/Delete/Filename
        public ActionResult Delete(string filename, string filetype)
        {
            IUploadRepository uploadrep = new IOUploadRepository();

            if (filetype == "Image")
                uploadrep.DeleteImageUpload(Convert.ToInt32(Session["UserAccountID"]), filename, Server.MapPath(@"~/UploadedFiles"));
            else if (filetype == "Video")
                uploadrep.DeleteVideoUpload(Convert.ToInt32(Session["UserAccountID"]), filename, Server.MapPath(@"~/UploadedFiles"));
            else
                uploadrep.DeleteMusicUpload(Convert.ToInt32(Session["UserAccountID"]), filename, Server.MapPath(@"~/UploadedFiles"));

            return RedirectToAction("Index");
        }
示例#2
0
        private List<Upload> GetUploads()
        {
            IUploadRepository uploadrep = new IOUploadRepository();

            User user = (User)Session["User"];

            List<Upload> images = uploadrep.GetImageUploads(user.AccountID, Server.MapPath(@"~/UploadedFiles")).ToList();
            List<Upload> videos = uploadrep.GetVideoUploads(user.AccountID, Server.MapPath(@"~/UploadedFiles")).ToList();
            List<Upload> musics = uploadrep.GetMusicUploads(user.AccountID, Server.MapPath(@"~/UploadedFiles")).ToList();

            List<Upload> uploads = new List<Upload>();
            foreach (Upload image in images)
            {
                uploads.Add(image);
            }
            foreach (Upload video in videos)
            {
                uploads.Add(video);
            }
            foreach (Upload music in musics)
            {
                uploads.Add(music);
            }

            return uploads;
        }