private void EditData() { int index = dataGrid.SelectedRows[0].Index; Flaw temp = sql.findFlaw(Int32.Parse(dataGrid.Rows[index].Cells[0].Value.ToString())); AddFlaw addFlaw = new AddFlaw(); addFlaw.changeFlaw(temp); LoadData(); }
public static FlawViewModel ToViewModel(this Flaw flaw) { return(new FlawViewModel { FlawId = flaw.Id, Mods = flaw.Mods.Select(sm => sm.ToViewModel()).ToList(), Name = flaw.Name, Description = flaw.Description, Author = flaw.Player?.ToViewModel() }); }
public void changeFlaw(Flaw flaw) { this.flaw = flaw; this.product = sql.findProduct(flaw.ProductID); OrderIDEdit.Text = product.ID.ToString(); OrderEdit.Text = product.Name; CountEdit.Value = flaw.Count; SummToPayEdit.Text = flaw.Price.ToString(); AddBtn.Text = "Зберегти"; this.Text = product.Name; AddBtn.Click -= AddBtn_Click; AddBtn.Click += SaveBtn_Click; this.ShowDialog(); }
public AddFlaw() { InitializeComponent(); flaw = new Flaw(); product = new Product(); }