I have an MVC5 application. There is a specific action that processes the downloaded large CSV file, and sometimes it requires additional information from the user during this task. For example, in line 5, the software should show confirmation to the user that he really wants to do something with him, etc. In Winforms, this was very simple, but I have no idea how I can implement the same thing on the Internet.
I would prefer a synchronous path so that the server thread will be blocked until confirmation. Otherwise, I feel like I have to completely rewrite the logic.
What makes things even more complicated is that I will need not only simple confirmation, but from time to time there may be more complex options for the user that cannot be implemented synchronously on the client side (only native simple confirmis synchronous AFAIK) .
Any suggestions or tips would be appreciated, a complete short guide even further.
Example
In this example, the client calls a method that returns numbers 0, 1, 2, ..., 99, 100. Let them say that our users potentially hate numbers that are divisible by 5. We need to implement a function that allows users to exclude these numbers if they want to. Users do not like to plan for the future, so they want to choose whether they like the number or not in real time when the processing takes place.
[Controller]
public enum ConfirmResult {
Yes = 0,
No = 1,
YesToAll = 2,
NoToAll = 3
}
...
public JsonResult SomeProcessingAction() {
var result = new List<int>();
for (int i = 0; i <= 100; i++) {
if (i%5==0) {
if (Confirm(string.Format("The number {0} is dividable by 5. Are you sure you want to include it?", i) == ConfirmResult.No)
continue;
}
result.Add(i);
}
return Json(result);
}
public ConfirmResult Confirm(string message) {
}
[Javascript]
$.post('mycontroller/someprocessing', function(result) {
$('#results').text("Your final numbers: " + result.join(', '));
});