public EditInventory(Inventory inventory) { InitializeComponent(); EditInventoryModel context = new EditInventoryModel(); this.DataContext = context; PutInventoryToContext(inventory); OldInventory = inventory; }
private Inventory GetInventoryFromContext() { EditInventoryModel context = this.DataContext as EditInventoryModel; return(new Inventory { Number = context.Number, Object = context.ObjectName, InDate = context.InDate, Price = context.Price, Repack = context.Repack }); }
private void PutInventoryToContext(Inventory inventory) { EditInventoryModel context = this.DataContext as EditInventoryModel; context.Number = inventory.Number; context.ObjectName = inventory.Object; context.InDate = inventory.InDate; context.Price = inventory.Price; context.Repack = inventory.Repack; if (InventoryId == null) { InventoryId = inventory.Id; } }