Ejemplo n.º 1
0
        internal filelist GetClassSharedFiles(User user, Class userclass)
        {
            filelist myList = new filelist();
            List<Class> userclasses = GetClasses(user);


            string pathextension = userclass.SharedPath;
            var dir = new System.IO.DirectoryInfo(Path.Combine(HttpRuntime.AppDomainAppPath, "/UploadedFiles/", pathextension));
            List<System.IO.FileInfo> filenames = dir.GetFiles("*.*").ToList();

            var results = from f in filenames
                          select new filelistviewmodel()
                          {
                              filename = f.Name,
                              filecreation = f.CreationTimeUtc,
                              filepath = f.FullName,

                          };
            foreach (var item in results)
            {
                myList.SharedFilelist.Add(item);
            }
            return myList;
        }
Ejemplo n.º 2
0
 public int CreateClass(FormCollection collection, User currentUser)
 {
     string name = collection.Get("name");
     string code = collection.Get("code");
     var dir = Path.Combine(HttpRuntime.AppDomainAppPath,"/UploadedFiles/");
     string classpath = dir + code;
     string sharedPath = classpath + "/shared/";
     string taskPath = classpath + "/task/";
     Directory.CreateDirectory(sharedPath);
     Directory.CreateDirectory(taskPath);
     Class zeClass = new Class { Name = name, Code = code, SharedPath = code + "/shared/", TaskPath = code + "/task/", Users = new List<User>() };
     db.Classes.Add(zeClass);
     db.SaveChanges();
     if (collection.Get("teach") == "on")
     {
         Associate(currentUser.Id, zeClass.Id);
     }
     return zeClass.Id;
 }