public ActionResult File()
        {
            FileRegistrationVM overzicht = new FileRegistrationVM();
            overzicht.Me = FileRegistrationDA.getMijnBestanden(User.Identity.Name);
            if (User.IsInRole("Administrator"))
            {
                overzicht.Others = FileRegistrationDA.getAlleBestanden();
            }
            else
            {
                overzicht.Others = FileRegistrationDA.getBestandenToegang(User.Identity.Name);
            }


            return View(overzicht);
        }
        public ViewResult Delete2(int? id)
        {
            FileRegistration file = FileRegistrationDA.GetFileRegistrationById(id.Value);    
            int affected = FileRegistrationDA.DeleteFile(id.Value);

            if(affected > 0)
            {
                string path = Server.MapPath("~/app_data/Uploads/");
                path += file.FileName;

                FileInfo bestand = new FileInfo(path);
                bestand.Delete();
            }

            FileRegistrationVM overzicht = new FileRegistrationVM();
            overzicht.Me = FileRegistrationDA.getMijnBestanden(User.Identity.Name);
            overzicht.Others = FileRegistrationDA.getBestandenToegang(User.Identity.Name);
            return View("File", overzicht);
        }
 public ViewResult Edit2(FileRegistration file)
 {
     if (file.UserName == User.Identity.Name)
     {
         FileRegistrationDA.UpdateFile(file);
         FileRegistrationVM overzicht = new FileRegistrationVM();
         overzicht.Me = FileRegistrationDA.getMijnBestanden(User.Identity.Name);
         overzicht.Others = FileRegistrationDA.getBestandenToegang(User.Identity.Name);
         return View("File", overzicht);
     }
     else
     {
         return View("Error");
     }
 }