// DELETE: api/FaxFolders/5
        public IHttpActionResult Delete(string id)
        {
            FolderRepository folderRepository = new FolderRepository();
            folderRepository.RemoveFolder(id);

            return Ok();
        }
        // DELETE: api/Folders/5
        public IHttpActionResult Delete(int id)
        {
            FolderRepository folderRepository = new FolderRepository();

            if (folderRepository.CheckForDocuments(id) != true)
            {
                folderRepository.DeleteFolderName(id);
                return Ok();
            }

            return BadRequest("Cannot delete There are files still in the folder");
        }
        // GET: api/FolderList/5
        public IEnumerable<KendoTreeViewViewModel> Get(string id)
        {
            FaxRepository faxData = new FaxRepository();

            string path = string.Empty;

            if (id.Substring(1, 1) == ":")
            {
                path = id;
            }
            else
            {
                path = ConfigurationValues.DefaultFolderFaxes;
            }

            var directories = Directory.GetDirectories(path).Select(dir =>
                new KendoTreeViewViewModel
                {
                    Id = dir,
                    HasChildren = true,
                    Name = Path.GetFileName(dir)
                });


            var result = directories.ToList();

            for (int i = 0; i < result.Count; i++)
            {
                string newName = faxData.GetPostOfficeFaxFolderTranslation(result[i].Name);
                if (newName != "None")
                {
                    result[i].Name = newName;
                }
            }

            //result.AddRange(directories);
            result = result.OrderBy(x => x.HasChildren).ToList();

            FolderRepository folderData = new FolderRepository();

            for (int i = 0; i < result.Count; i++)
            {
                result[i] = folderData.GetCheckedFolders(result[i]);
            }
            return result;
        }
 // POST: api/FaxFolders
 public void Post([FromBody]List<FaxFolders> faxFolders)
 {
     FolderRepository folderRepository = new FolderRepository();
     folderRepository.AddPostOfficeFolders(faxFolders);
 }
 // GET: api/FaxFolders/5
 public IEnumerable<UserFolder> Get(int id)
 {
     FolderRepository folderRepository = new FolderRepository();
     return folderRepository.GetFaxFoldersByUsers();
 }
 // GET: api/FaxFolders
 public IEnumerable<FaxFolders> Get()
 {
     FolderRepository folderRepository = new FolderRepository();
     return folderRepository.GetFaxFolders();
 }
 // POST: api/UserFolders
 public void Post([FromBody]List<UserFolder> userFolderList)
 {
     FolderRepository folderData = new FolderRepository();
     folderData.AddPostOfficeFoldersByUser(userFolderList);
 }
 // POST: api/Folders
 public void Post([FromBody]Folder folderToUpdate)
 {
     FolderRepository folderRepository = new FolderRepository();
     folderRepository.UpdateFolderName(folderToUpdate.Id.ToString(), folderToUpdate.FolderName);
 }
 // GET: api/Folders/5
 public IEnumerable<Folder> Get(string id)
 {
     FolderRepository folderRepository = new FolderRepository();
     return folderRepository.GetFolders(id);
 }
 // GET: api/SendToUser
 public IEnumerable<FaxFolders> Get()
 {
     string filter = System.Web.Http.HttpRequestMessageExtensions.GetQueryString(Request, "filter.filters[0].value");
     FolderRepository folderRepository = new FolderRepository();
     return folderRepository.GetSendToNames(filter);
 }
 // GET: api/FaxNumber
 public int Get()
 {
     FolderRepository folderData = new FolderRepository();
     return folderData.GetFaxNumber();
 }