Exemple #1
0
        public ActionResult Create(FolderBindingModel form)
        {
            // find the parrent folder base on logical location

            var _name = form.Location.Substring(form.Location.LastIndexOf('/') + 1);
            var _location = form.Location.LastIndexOf('/') >= 0 ? form.Location.Substring(0, form.Location.LastIndexOf('/')) : string.Empty;

            var container = _uow.Documents.FilterBy(d => d.Location == _location && d.Name == _name).FirstOrDefault();

            // create child directory within the Path of the container
            string path = container == null ?
                            string.Format("{0}/{1}/{2}", Server.MapPath(_config.BaseUrl), _user.User.Email, form.Name) :
                            string.Format("{0}/{1}", container.Path, form.Name);
            var dir = Directory.CreateDirectory(path);


            if (Directory.Exists(dir.FullName))
            {
                //register with the system
                var document = Doc.CreateFile(form.Name, string.Empty, true, dir.FullName, container, _user.User);
                document.Location = container == null ? form.Location : string.Format("{0}/{1}", container.Location, container.Name);

                _uow.Documents.Add(document);
                _uow.Save();
                return RedirectToAction<DocumentController>(c => c.Browse(document.Location));
            }

            return RedirectToAction<DocumentController>(c => c.Browse(_home));

        }
Exemple #2
0
 public ActionResult Create(string location)
 {
     var vm = new FolderBindingModel(location);
     return View(vm);
 }