public async Task <IActionResult> Edit(int id, [Bind("ExportID,date,ProductID,quantity,PartnerID,sale_price")] Export export) { if (id != export.ExportID) { return(NotFound()); } if (ModelState.IsValid) { try { if (!ModifyProduct.editExport(export, modifiesDb, _context)) { } _context.Update(export); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ExportExists(export.ExportID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PartnerID"] = new SelectList(_context.Partner, "PartnerID", "PartnerID", export.PartnerID); ViewData["ProductID"] = new SelectList(_context.Product, "ProductID", "name", export.ProductID); return(View(export)); }
private void modifyProductToolStripMenuItem1_Click(object sender, EventArgs e) { CloseActiveChildForms(); ModifyProduct modifyProduct = new ModifyProduct(); modifyProduct.MdiParent = this; modifyProduct.Show(); }
private void BtnSave_Click(object sender, EventArgs e) { ProductViewModel viewModel = new ProductViewModel() { NameText = txtName.Text, PriceText = txtPrice.Text, PhotoPathText = txtPhotoPath.Text }; ModifyProduct?.Invoke(this, viewModel); }
public async Task <IActionResult> DeleteConfirmed(int id) { var export = await _context.Export.SingleOrDefaultAsync(m => m.ExportID == id); if (!ModifyProduct.deleteExport(export, _context)) { } _context.Export.Remove(export); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
public void btnModify_Click(object sender, EventArgs e) { removeAllManagamentControls(); switch (this.Mantenimiento) { case "Users": ModifyUser modifyUser = new ModifyUser(); Parent.Controls.Add(modifyUser); break; case "Clients": ModifyClient modifyClient = new ModifyClient(); Parent.Controls.Add(modifyClient); break; case "States": ModifyState modifyState = new ModifyState(); Parent.Controls.Add(modifyState); break; case "PaymentMethods": ModifyPaymentMethod modifyPaymentMethod = new ModifyPaymentMethod(); Parent.Controls.Add(modifyPaymentMethod); break; case "MaterialTypes": ModifyMaterialType modifyMaterialType = new ModifyMaterialType(); Parent.Controls.Add(modifyMaterialType); break; case "Materials": ModifyMaterial modifyMaterial = new ModifyMaterial(); Parent.Controls.Add(modifyMaterial); break; case "ProductTypes": ModifyProductType modifyProductType = new ModifyProductType(); Parent.Controls.Add(modifyProductType); break; case "Products": ModifyProduct modifyProduct = new ModifyProduct(); Parent.Controls.Add(modifyProduct); break; case "Providers": EditProvider edP = new EditProvider(); Parent.Controls.Add(edP); break; } }
private void btnEditSelectedProduct_Click(object sender, RoutedEventArgs e) { ModifyProduct mod = new ModifyProduct(); Product p = (Product)lvProductList.Items.GetItemAt(selectedProductIndex); mod.lblProductIdEdit.Content = p.ProductId; mod.tbProductNameEdit.Text = p.ProductName; mod.tbCategoryEdit.Text = p.Category; mod.tbDescriptionEdit.Text = p.Description; mod.tbPriceEdit.Text = p.Price.ToString(); mod.tbSCUEdit.Text = p.SCU.ToString(); mod.tbQuantityEdit.Text = p.Quantity.ToString(); mod.tbLocationEdit.Text = p.Location; mod.tbSupplierEdit.Text = p.SupplierName; mod.Show(); }
public async Task <IActionResult> Create([Bind("ExportID,date,ProductID,quantity,PartnerID,sale_price")] Export export) { if (ModelState.IsValid) { _context.Add(export); if (!ModifyProduct.createExport(export, _context)) { } await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PartnerID"] = new SelectList(_context.Partner, "PartnerID", "PartnerID", export.PartnerID); ViewData["ProductID"] = new SelectList(_context.Product, "ProductID", "name", export.ProductID); return(View(export)); }