public void UpdateListItem(ListItemModel listItemModel) { _log.Debug("userId={0}, {1}", userId, listItemModel); var updatedListItemModel = new ListItemModel( _listItemService.Update(listItemModel.Description, listItemModel.Quantity, listItemModel.Id, listItemModel.ShoppingListId) ); Clients.Group(listItemModel.ShoppingListId.ToString()).listItemUpdated(updatedListItemModel); }
public SPListItem Update(Guid listId, SPListItemUpdateOptions options) { var listItemId = options.ItemId.HasValue ? options.ItemId.Value.ToString(CultureInfo.InvariantCulture) : options.UniqueId.ToString("N"); var beforeUpdateListItem = Get(listId, options); if (beforeUpdateListItem == null) { return(null); } try { Events.OnBeforeUpdate(beforeUpdateListItem); } catch (Exception ex) { string message = string.Format("An exception of type {0} occurred in the PublicApi.ListItems.Events.OnBeforeUpdate() method ListId: {1} ListItemId: {2}. The exception message is: {3}", ex.GetType(), listId, listItemId, ex.Message); SPLog.UnKnownError(ex, message); } var afterUpdateListItem = listItemService.Update(listId, options); ExpireTags(afterUpdateListItem.ListId); var listItem = Get(listId, options); if (listItem != null) { // TODO: try { Events.OnAfterUpdate(listItem); } catch (Exception ex) { string message = string.Format("An exception of type {0} occurred in the PublicApi.ListItems.Events.OnAfterUpdate() method ListId: {1} ListItemId: {2}. The exception message is: {3}", ex.GetType(), listId, listItemId, ex.Message); SPLog.UnKnownError(ex, message); } } return(listItem); }
public Document Update(Guid libraryId, DocumentUpdateOptions options) { var documentId = options.Id.HasValue ? options.Id.Value.ToString(CultureInfo.InvariantCulture) : options.ContentId.ToString("N"); var documentBeforeUpdate = Get(libraryId, options); if (documentBeforeUpdate == null) { return(null); } try { Events.OnBeforeUpdate(documentBeforeUpdate); } catch (Exception ex) { var message = string.Format("An exception of type {0} occurred in the PublicApi.Documents.Events.OnBeforeUpdate() method for LibraryId: {1}, DocumentId: {2}. The exception message is: {3}", ex.GetType(), libraryId, documentId, ex.Message); SPLog.UnKnownError(ex, message); } listItemService.Update(libraryId, options); ExpireTags(libraryId); var document = Get(libraryId, options); if (document != null) { try { Events.OnAfterUpdate(document); } catch (Exception ex) { string message = string.Format("An exception of type {0} occurred in the PublicApi.Documents.Events.OnAfterUpdate() method for LibraryId: {1}, DocumentId: {2}. The exception message is: {3}", ex.GetType(), libraryId, documentId, ex.Message); SPLog.UnKnownError(ex, message); } } return(document); }