示例#1
0
 public ActionResult ChangeFileName(int ProjectID, int FileID, string NewName)
 {
     // If the user can open the project he can also change file names.
     if (Pservice.CanUserOpenProject(ProjectID, User.Identity.Name))
     {
         // If the we get the file that was changed we return it.
         var FileChanged = FService.ChangeFileName(ProjectID, FileID, NewName);
         if (FileChanged != null)
         {
             return(Json(FileChanged, JsonRequestBehavior.AllowGet));
         }
         else
         {
             // If we don't get the file we return this to JavaScript code
             // for error handling.
             return(Json("SameName", JsonRequestBehavior.AllowGet));
         }
     }
     throw new ArgumentException();;
 }