public ActionResult UploadPolicyDoc()
        {
            var fullPath = Server.MapPath(@"~/PolicyDocuments");
            var ops = new PolicyDocumentsOperations();
            var model = new CategoryVM();

            var response = ops.GetAllCategories(fullPath);

            model.CreateCategoryList(response.Data);

            return View(model);
        }
        public ActionResult SavePolicyDocument(HttpPostedFileBase file, CategoryVM model)
        {
            if (file.ContentLength > 0)
            {
                var fullPath = Server.MapPath(@"~/PolicyDocuments");
                var filePathComplete = String.Format(@"{0}\{1}\{2}", fullPath, model.PolicyDocumentToAdd.Category.CategoryName, file.FileName);
                model.PolicyDocumentToAdd.FilePath = filePathComplete;

                var ops = new PolicyDocumentsOperations();

                var folderPath = fullPath + @"\" + model.PolicyDocumentToAdd.Category.CategoryName;
                ops.AddPolicyDocument(model.PolicyDocumentToAdd, folderPath);
                //file.SaveAs(filePathComplete);

            }

            return RedirectToAction("ViewPolicyDocuments", new { nameOfCategory = model.PolicyDocumentToAdd.Category.CategoryName });
        }
示例#3
0
        public ActionResult SelectPolicyCategories()
        {
            var fullPath = Server.MapPath(@"~/PolicyDocuments/PolicyDocuments.txt");
            var model = new CategoryVM();
            var ops = FileManager.CreatePolicyDocumentOperations();
            var response = ops.GetAllCategories(fullPath);
            model.CreateCategoryList(response.Data);

            return View(model);
        }
        public ActionResult ViewPolicyDocuments(string nameOfCategory)
        {
            var filePathToMap = string.Format(@"~/PolicyDocuments/{0}", nameOfCategory);
            var filePath = Server.MapPath(@filePathToMap);
            var ops = new PolicyDocumentsOperations();
            var model = new CategoryVM()
            {
                Response = ops.GetAllPolicyDocuments(filePath, nameOfCategory),
                Category = new Category()
                {
                    CategoryName = nameOfCategory
                }

            };

            return View(model);
        }
 public ActionResult SelectPolicyDocCategory(CategoryVM model)
 {
     return RedirectToAction("ViewPolicyDocuments", new { nameOfCategory = model.Category.CategoryName });
 }