Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Action text on custom activity in Activity logging

$
0
0

I have made a new Activity type to use for logging changes to Users. So that changes will show up in the Change Log in episerver

This is my new activity:

public class UserActivity : Activity
{
  public UserActivity(string activityType, int action) : base(activityType, action)
  {
  }

  public UserActivity(string activityType, int action, IDictionary<string, string> extendedData) : base(activityType, action, extendedData)
  {
  }
}

public enum UserActivityType
{
  Create,
  Update,
  Delete
}

and here is the code i use when adding an activity

var activityRepository = ServiceLocator.Current.GetInstance<IActivityRepository>();

var data = new Dictionary<string, string>();
data.Add("Username", username);
var activity = new UserActivity("User", (int)UserActivityType.Delete, data);

now an entry will appear in the Change Log, with Category = "User" but the Action is 2.

How do i change the shown action to a string i define instead of the int value?


Viewing all articles
Browse latest Browse all 9076

Trending Articles