public moveFolder ( int userID, string folderToMoveID, int destinationFolderID ) : bool | ||
userID | int | |
folderToMoveID | string | |
destinationFolderID | int | |
Résultat | bool |
public ActionResult EditFolder(FormCollection form, string saveChanges, string cancelChanges) { Tools toolbelt = new Tools(); bool SuccessfulMove = toolbelt.moveFolder(WebSecurity.CurrentUserId, form["fid"], form["InFolderID"]); bool successfulNameChange = toolbelt.changeFolderName(WebSecurity.CurrentUserId, Convert.ToInt32(form["fid"]), form["FolderName"]); string errorMessage = ""; string redirectUrl = "./../Home/Album?folderID=" + form["InFolderID"]; if (!SuccessfulMove) { errorMessage += "<ERROR>This Edit Has Failed\nThe folder was not moved</ERROR>"; redirectUrl="./../Home/Album";} if (!successfulNameChange) { errorMessage += "<ERROR>This Edit Has Failed\nThe folder name was not changed</ERROR>"; redirectUrl = "./../Home/Album"; } ViewBag.UserID = new SelectList(dbContext.Users, "UserID", "UserName", WebSecurity.CurrentUserId); ViewBag.FolderID = new SelectList(dbContext.Folders, "FolderID", "FolderName", form["InFolderID"]); Response.Redirect(redirectUrl+errorMessage); return PartialView(); }
public ActionResult MoveFolderTo(MoveItemList moveItemList) { Tools toolbelt = new Tools(); int? newFolderID; int? currentFolder; IList<string> selectedItems = new List<string> { }; {// Initialise Posted string variables into workable data if (moveItemList.selected != null) { selectedItems = moveItemList.selected.Split((new char[] { ',' }), StringSplitOptions.RemoveEmptyEntries); } newFolderID = Convert.ToInt32(moveItemList.destinationFolder); currentFolder = Convert.ToInt32(moveItemList.sourceFolder); if (currentFolder <= 0) { currentFolder = null; } } string ReturnValue = "Count :" + selectedItems.Count ; // Move all the folders that need be moved. for (int i = 0; i < selectedItems.Count ; i++) { bool SuccessfulMove = toolbelt.moveFolder(WebSecurity.CurrentUserId, selectedItems.ElementAt(i).ToString(), newFolderID); ReturnValue += "Folder : " + selectedItems.ElementAt(i).ToString() + " : Success : " + SuccessfulMove + "\n"; } return Content(ReturnValue); }