public void TestFileNameUniqueness()
        {                       
            var fileNameHelper = new FileNameHelper();
              
            // Check for override
            var overrideUniqueness = fileNameHelper.IsUnique(docA.FileName, docA.ProfileId);
            Assert.AreEqual(FileNameHelper.Uniqueness.UniqueToProfile, overrideUniqueness);

            // Check same filname for different profile
            var notUnique = fileNameHelper.IsUnique(docA.FileName, ProfileIds.Phof);
            Assert.AreEqual(FileNameHelper.Uniqueness.NotUnique, notUnique);

            // Check a unique filename 
            var unique = fileNameHelper.IsUnique(docB.FileName, docB.ProfileId);
            Assert.AreEqual(FileNameHelper.Uniqueness.Unique, unique);
        }
 public ActionResult IsFileNameUnique(string filename, string selectedProfileId)
 {            
     if (string.IsNullOrEmpty(selectedProfileId))
     {
         return new HttpStatusCodeResult(400, "bad request");
     }
     
     var profileId = Convert.ToInt32(selectedProfileId);
     var fileNameHelper = new FileNameHelper();
     
     return new JsonResult
     {
         Data = fileNameHelper.IsUnique(filename, profileId),
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }