public ActionResult SetOrderItemPurchaseLibrary(int orderNodeId, PurchaseLibraries purchaseLibrary) { var json = new ResultResponse(); try { var eventId = _orderItemManager.GenerateEventId(EVENT_TYPE); // Use internal method to set status property and log the result _orderItemManager.SetPurchaseLibrary(orderNodeId, purchaseLibrary, eventId); // Construct JSON response for client (ie jQuery/getJSON) json.Success = true; json.Message = "Changed purchase library to " + purchaseLibrary.ToString(); } catch (Exception e) { json.Success = false; json.Message = "Error: " + e.Message; } return(Json(json, JsonRequestBehavior.AllowGet)); }