public void LockDataTransferConfigurationTest() { var testUser = GetTestUser(); var testCompany = GetTestCompany(testUser); // Create a record var model = createDataTransfer(testCompany, testUser); var error = DataTransferService.InsertOrUpdateDataTransferConfiguration(model, testUser, ""); Assert.IsTrue(!error.IsError, $"Error: {error.Message}"); // Get the current Lock string lockGuid = DataTransferService.LockDataTransferConfiguration(model); Assert.IsTrue(!string.IsNullOrEmpty(lockGuid), "Error: Lock record was not found"); // Simulate another user updating the record var otherUser = GetTestUser(); error = DataTransferService.InsertOrUpdateDataTransferConfiguration(model, otherUser, lockGuid); Assert.IsTrue(!error.IsError, error.Message); // Now get the first user to update the record error = DataTransferService.InsertOrUpdateDataTransferConfiguration(model, testUser, lockGuid); Assert.IsTrue(error.IsError, "Error: The lock should have caused an error as it has changed"); // Try to update with the new lock lockGuid = DataTransferService.LockDataTransferConfiguration(model); error = DataTransferService.InsertOrUpdateDataTransferConfiguration(model, testUser, lockGuid); Assert.IsTrue(!error.IsError, $"Error: {error.Message}"); }
public ActionResult Edit(int id) { var model = new EditFileTransferConfigurationViewModel(); prepareEditModel(model); model.FileTransferConfiguration = DataTransferService.FindDataTransferConfigurationModel(id, true); model.LGS = DataTransferService.LockDataTransferConfiguration(model.FileTransferConfiguration); return(View(model)); }