public static JsonResponse Process(string action, string[] vals)
{
try
{
string message = null;
foreach (var s in vals)
{
var ar = s.Split((":").ToCharArray());
if (action == "Purge" && ar[0] == "All" && ar[1] == "All")
{
PurgeAll();
message = "Trash is empty!";
}
else
{
if (action == "Purge")
{
Purge(ar[0], new Guid(ar[1]));
message = string.Format("Item{0} purged",(vals.Length > 1) ? "s" : "");
}
else if (action == "Restore")
{
Restore(ar[0], new Guid(ar[1]));
message = string.Format("Item{0} restored", (vals.Length > 1) ? "s" : "");
}
}
}
if (string.IsNullOrEmpty(message))
return new JsonResponse { Success = true, Message = "Nothing to process" };
else
return new JsonResponse { Success = true, Message = message };
}
catch (Exception ex)
{
return new JsonResponse { Message = "BlogEngine.Core.Json.JsonTrashList.Restore: " + ex.Message };
}
}