public override async Task HandleAsync(EditEntityCommand <TEntity> command) { //TODO id можно отдельно передавать в команде, тогда ограничение "where TEntity : DomainObject" можно убрать var dbEntity = await Repository.FindAsync <TEntity>(command.Entity.Id); if (dbEntity == null) { throw new EntityNotFoundException(); } Mapper.Map(command.Entity, dbEntity); await Repository.SaveChangesAsync(); }
public BaseDataModel() { // setup ContentScale = 1; SelectedEntities = new ObservableCollection <IVisualElement>(); SelectedEntities.CollectionChanged += SelectedEntities_CollectionChanged; CornerManipulators = new ObservableCollection <VisualCornerManipulator>(); MapEntities = new ObservableCollection <IVisualElement>(); // commands UndoCommand = new UndoCommand(this); RedoCommand = new RedoCommand(this); CopyCommand = new CopyCommand(this); PasteCommand = new PasteCommand(this); DeleteCommand = new DeleteCommand(this); DeselectAllCommand = new DeselectAllCommand(this); EditEntityCommand = new EditEntityCommand(this); CreateMarkerCommand = new CreateMarkerCommand(this); ShowManipulationPoints = new ShowManipulationPoints(this); CreateWallCommand = new CreateWallCommand(this); CreateDoorCommand = new CreateDoorCommand(this); }