Example #1
0
        public ActionResult Create2(int id)
        {
            this.serviceLog.LogMessage("FileController", "Create2 " + id);
            ViewBag.ProjectId = id;

            List <VMFileCreate> model = new List <VMFileCreate>();
            var tmpFiles = this.serviceTempFile.GetByProjectId(id, CurrentUser);

            if (tmpFiles == null || tmpFiles.Count == 0)
            {
                return(this.RedirectToErrorPage("Il faudrait peut etre ajouter des fichiers!"));
            }
            foreach (var tmpFile in tmpFiles)
            {
                var modelFile = new VMFileCreate();

                modelFile.File             = new ProjectFile();
                modelFile.File.DisplayName = modelFile.File.InternalName = System.IO.Path.GetFileNameWithoutExtension(tmpFile.Name);

                modelFile.Project = new Project()
                {
                    Id = id
                };
                modelFile.File.Id = tmpFile.Id;
                model.Add(modelFile);
            }
            return(PartialView(model));
        }
Example #2
0
        public ActionResult Create(int id)
        {
            this.serviceLog.LogMessage("FileController", "Create " + id);
            var project = serviceProject.GetById(id);

            if (project == null)
            {
                return(HttpNotFound());
            }
            VMFileCreate model = new VMFileCreate()
            {
                Project = project
            };
            var userStorages = this.serviceUser.GetUserStorages(CurrentUser);

            var items = userStorages.CloudStorages
                        .Where(c => c.Status == CredentialStatus.Approved)
                        .Select(c => new { id = c.Id, value = c.CloudService + "-" + c.Login });

            if (items.Count() > 0)
            {
                SelectList CloudStorages = new SelectList(items, "id", "value");
                ViewBag.CloudStorages = CloudStorages;
            }
            else
            {
                ViewBag.CloudStorages = null;
            }

            return(View(model));
        }