public ActionResult SaveFtpServer(FtpServer ftpServer) { // Ftp Server connection test bool result = FtpServerFilesRepository.FtpConnectionTest(ftpServer); if (result) { // Get current user id from session int userId = (int?)System.Web.HttpContext.Current.Session["UserId"] ?? 0; //// ERROR HANDLE NEEDED WHEN session does not exist /// // Set user id ftpServer.UserId = userId; // Update Ftp Server info in FtpServers table UserRepository.UpdateFtpServer(ftpServer); // Update Cloud Service Status in Users table UserRepository.UpdateCloudServiceStatus(userId, true, (byte)CloudStorage.Models.User.ServiceType.FtpServer); return(Content("Ftp Server service has been registered SUCCESSFULLY.")); } else { return(View("FtpServerForm")); } }
public ActionResult ProcessForm(FtpServer ftpServer) { // Save ftp server info into DB /* is going to implement */ // Get file name string uploadedFileName = System.Web.HttpContext.Current.Session["uploadedFileName"] as String; // Upload file to FTP Server FtpServerFilesRepository.UploadFileToFtpServer(uploadedFileName); // Display file list on FTP Server return(RedirectToAction("GetFtpServerFiles")); }
public ActionResult GetFtpServerFiles() { return(View("GetCloudDriveFiles", FtpServerFilesRepository.GetFtpServerFiles())); }