/// <summary> /// Use this method to update an existing <see cref="Category"/>. /// </summary> /// <param name="categoryId">Id of the category</param> /// <param name="name">The updated name.</param> /// <param name="sortOrder">The updated sort order.</param> /// <param name="description">The updated description.</param> /// <returns>The updated category.</returns> /// <exception cref="ArgumentNullException">If the name or categoryId parameters or null/empty strings.</exception> /// <exception cref="PermissionException">If the current user does not have the required permissions.</exception> public Category Update(String categoryId, String name, Int32 sortOrder, String description) { if (String.IsNullOrWhiteSpace(categoryId)) { throw new ArgumentNullException(nameof(categoryId)); } if (String.IsNullOrWhiteSpace(name)) { throw new ArgumentNullException(nameof(name)); } this.loggingService.Application.DebugWriteFormat("Update called on CategoryService, Id: {0}, Name: {1}, Description: {2}, Sort Order: {3}", categoryId, name, description, sortOrder); IAuthenticatedUser currentUser = this.userProvider.CurrentUser; if (currentUser == null || !currentUser.CanUpdateCategory(this.permissionService)) { this.loggingService.Application.DebugWriteFormat("User does not have permissions to update a category, Id: {0}", categoryId); throw new PermissionException("create category", currentUser); } Category output = this.dataStore.UpdateCategory(categoryId, name, sortOrder, description); this.loggingService.Application.DebugWriteFormat("Category updated in CategoryService, Id: {0}", output.Id); CategoryUpdated afterEvent = new CategoryUpdated { Name = output.Name, CategoryId = output.Id, Author = this.userProvider.CurrentUser }; this.eventPublisher.Publish <CategoryUpdated>(afterEvent); return(output); }
protected void ClosePopup() { // Refresh collection on parent CategoryUpdated.InvokeAsync(true); // Close Popup ShowManager = false; }
void When(CategoryUpdated evnt) { UpdateCategory(evnt.BudgetId, evnt.CategoryId, evnt.Name, evnt.Description); }
public void Apply(CategoryUpdated message) { Name = message.Name; }
public virtual void OnCategoryUpdated() { CreateNotification(EventActionType.Updated); CategoryUpdated?.Invoke(this, new NewNotificationEventArgs(this)); }
private static void OnCategoryUpdated(CategoryUpdateEventArgs e) { CategoryUpdated?.Invoke(null, e); }
public void Handle(CategoryUpdated @event, CommerceInstance instance) { CategoryTree.Remove(CommerceInstance.Current.Name); }