Here is what I am trying to do. Pay close attention to the InsertConlogEntry and how I am trying to assign it to my DelegateCommand, but, how do I handle the return int?
Thank you,
#region Members
public static readonly string AddConlogEntry = "AddConlogEntry";
public static readonly string GetConlogList = "GetConlogList";
public static readonly string GetConlogEntry = "GetConlogEntry";
public static readonly string Scope = "ConLog";
#endregion
#region Ctor
public ConLogCommands() :base()
{
scope = Scope;
DelegateCommand<ConlogEntryData> AddEntryCmd = new DelegateCommand<ConlogEntryData>("Add New Conlog Entry",
"AddConLogEntry", InsertConlogEntry);
this.Add(AddEntryCmd);
}
#endregion
#region Methods
private int InsertConlogEntry(ConlogEntryData data)
{
ConlogService service = new ConlogService();
return service.InsertConlogEntry(data.LoanNumber, data.UserId, data.Subject, data.Comment, data.EntryDate);
}
Commands are meant to be actions – not functions. As such, they shouldn’t return any values.
A command is meant to be an action that fires in response to some input. The logic should, technically, be self-contained.
That being said, if you need to just call this method and ignore the results, you can wrap it in an
Action<ConlogEntryData>and build your delegate command with that: