public ActionResult Sample20() { // Check is data posted if (Request.HttpMethod == "POST") { //### Set variables and get POST data System.Collections.Hashtable result = new System.Collections.Hashtable(); String clientId = Request.Form["clientId"]; String privateKey = Request.Form["privateKey"]; String resultFileId = Request.Form["resultFileId"]; // Set entered data to the results list result.Add("clientId", clientId); result.Add("privateKey", privateKey); result.Add("sourceFileId", resultFileId); String message = null; // Check is all needed fields are entered if (clientId == null || privateKey == null || resultFileId == null) { // If not all fields entered send error message message = "Please enter all parameters"; result.Add("error", message); return View("Sample20", null, result); } else { String basePath = Request.Form["basePath"]; //Check is base path entered if (basePath.Equals("")) { //If base path empty set base path to the dev server basePath = "https://api.groupdocs.com/v2.0"; } result.Add("basePath", basePath); // Create service for Groupdocs account GroupdocsService service = new GroupdocsService(basePath, clientId, privateKey); //###Make request to ComparisonApi using user id //Get changes list for document Groupdocs.Api.Comparison.Contract.ChangesResponse info = service.GetChanges(resultFileId); if (info.Status != null) { String action = null; String width = null; String height = null; String text = null; String type = null; //###Create table with changes for template String table = "<table class='border'>"; table += "<tr><td><font color='green'>Change Name</font></td><td><font color='green'>Change</font></td></tr>"; //Count of iterations for (int i = 0; i < info.Result.Changes.Length; i++) { //###Check received data if (info.Result.Changes[i].Action.ToString() == "") { action = ""; } else { action = info.Result.Changes[i].Action.ToString(); } if (info.Result.Changes[i].Page == null) { width = ""; } else { width = Convert.ToString(info.Result.Changes[i].Page.Width); } if (info.Result.Changes[i].Page == null) { height = ""; } else { height = Convert.ToString(info.Result.Changes[i].Page.Height); } if (info.Result.Changes[i].Text == null) { text = ""; } else { text = info.Result.Changes[i].Text; } if (info.Result.Changes[i].Type.ToString() == "") { type = ""; } else { type = info.Result.Changes[i].Type.ToString(); } //Formation of a body of the table table += "<tr><td>Id</td><td>" + info.Result.Changes[i].Id + "</td></tr>"; table += "<tr><td>Action</td><td>" + action + "</td></tr>"; table += "<tr><td>Text</td><td>" + text + "</td></tr>"; table += "<tr><td>Type</td><td>" + type + "</td></tr>"; table += "<tr><td>Width</td><td>" + width + "</td></tr>"; table += "<tr><td>Height</td><td>" + height + "</td></tr>"; table += "<tr bgcolor='#808080'><td></td><td></td></tr>"; } table += "</table>"; //Convert string to HTML string MvcHtmlString infoTable = MvcHtmlString.Create(table); //Return table to the template result.Add("info", infoTable); return View("SAmple20", null, result); } // If request return's null return error to the template else { result.Add("error", info.ErrorMessage); return View("Sample20", null, result); } } } // If data not posted return to template for filling of necessary fields else { return View("Sample20"); } }