public async Task <Counter> AddNewCounter(string name) { var counter = new Counter { Name = name }; await repository.Save(counter).ConfigureAwait(false); return(counter); }
public async Task <Counter> AddNewCounter(string account, string password) { var counter = new Counter { Account = account, Password = password }; await repository.Save(counter).ConfigureAwait(false); messenger.Publish(new CountersChangedMessage(this)); return(counter); }
//public CountersService(ICountersRepository repository, IMvxMessenger messenger) //{ // this.messenger = messenger; // this.repository = repository; //} public async Task <Counter> AddNewCounter(string name) { var counter = new Counter { Name = name }; await repository.Save(counter).ConfigureAwait(false); //messenger.Publish(new CountersChangedMessage(this)); return(counter); }
//Implementing the ICountersService interface public async Task <Counter> AddNewCounter(string name) { //A new counter is created from a name, stored in the repository, then removed. var counter = new Counter { Name = name }; await repository.Save(counter).ConfigureAwait(false); messenger.Publish(new CountersChangedMessage(this)); //Once a counter is saved, publish the message return(counter); }
public async Task <Counter> AddNewCounter(string name) { var counter = new Counter { Name = name }; await repository.Save(counter).ConfigureAwait(false); messenger.Publish(new CountersChangedMessage(this)); var props = new Dictionary <string, string>(); props.Add("Counter Name", name); Analytics.TrackEvent("Add new counter", props); return(counter); }