private void RemoveTextCommand(object parameter) { TextCommandModel model = (TextCommandModel)parameter; this.Commands.Remove(model); this.repository.Remove(model.Id); }
private void OnResponseUpdate(object sender, PropertyChangedEventArgs e) { TextCommandModel model = (TextCommandModel)sender; TextCommand entity = new TextCommand(); this.mapper.MapToEntity(model, entity); this.repository.AddOrUpdate(entity); }
protected override void Initialize() { IEnumerable <TextCommand> textCommands = this.repository.GetAll().OrderBy(c => c.Commands.OrderBy(text => text).FirstOrDefault()); foreach (TextCommand entity in textCommands) { TextCommandModel model = new TextCommandModel(); this.mapper.MapToModel(entity, model); this.Commands.Add(model); } this.Commands.RegisterCollectionItemChanged(this.OnResponseUpdate); }