public LocalizeCommentResponse GetLocalizeComments(LocalizeCommentsModel model) { var client = GetClient(); var response = new LocalizeCommentResponse(); try { response.comments = GetAppData(client, model.itemIds[0], model.appDataKey + "Comments"); response.lastCommentDate = GetAppData(client, model.itemIds[0], model.appDataKey + "Date"); response.user = GetAppData(client, model.itemIds[0], model.appDataKey + "User"); } catch (Exception ex) { throw new ApplicationException("Unable to get localization comments for the item[" + model.itemIds[0] + "]", ex); } finally { client.Close(); } return(response); }
[Route("LocalizeComment")] // needs to be changed public bool LocalizeComment(LocalizeCommentsModel model) { SessionAwareCoreServiceClient client = null; try { client = GetClient(); foreach (var itemId in model.itemIds) { try { Localize(client, itemId); var dict = new Dictionary <string, string>(); dict.Add(model.appDataKey + "Comments", model.comments); dict.Add(model.appDataKey + "User", Tridion.Web.UI.Core.Utils.GetUserName()); dict.Add(model.appDataKey + "Date", DateTime.Now.ToString()); SetAppData(client, itemId, dict); } catch (Exception ex) { throw new ApplicationException("Unable to save localization comments for the item[" + itemId + "]", ex); } } } catch (Exception ex) { throw new ApplicationException("Error in localize comment process", ex); } finally { if (client != null) { client.Close(); } } return(true); }