public void GetAllFilesTest() { var ops = new PolicyDocumentsOperations(); var filePath = @"C:\Users\Apprentice\Desktop\GitHub\KileyDowling\SGCorpHRV2\SGCorpHR\SGCorpHR.TEST\PolicyDocuments"; string categoryName = "DressCode"; var response = ops.GetAllPolicyDocuments(filePath, categoryName); Assert.IsTrue(response.Success); }
public void GetAllCategoriesTest() { var ops = new PolicyDocumentsOperations(); var folderPath = @"C:\Users\Apprentice\Desktop\GitHub\KileyDowling\SGCorpHRV2\SGCorpHR\SGCorpHR.TEST\PolicyDocuments"; var response = ops.GetAllCategories(folderPath); Assert.IsTrue(response.Success); Assert.AreEqual(3, response.Data.Count); }
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 })); }
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)); }