public bool AddNewProduct(T_Product product) { using (MEMSContext db = new MEMSContext()) { db.T_Product.Add(product); return db.SaveChanges() > 0 ? true : false; } }
protected override void AddObject() { m_product = new T_Product(); getData(); m_client.AddNewProduct(m_product); saveCraft(); base.AddObject(); }
public bool AddNewProduct(T_Product product) { try { ph = new ProductHelper(); return ph.AddNewProduct(product); } catch (Exception ex) { throw ex; } }
public bool UpdateProduct(T_Product product) { using (MEMSContext db = new MEMSContext()) { db.Entry(product).State = EntityState.Modified; return db.SaveChanges() > 0 ? true : false; } }
protected override void FormLoad() { var customerlst = m_client.getCustomerList(); foreach (var customer in customerlst) { cmb_cst.Properties.Items.Add(customer.customername); } cmb_cst.Properties.Tag = customerlst; if (formmode == frmmodetype.edit) { m_product = m_client.getProductbyId(m_pid); setData(); List<T_Crafts> craftlst = m_client.getProductCraft(m_pid); gccraft.DataSource = craftlst; } else if (formmode == frmmodetype.delete) { m_product = m_client.getProductbyId(m_pid); setData(); List<T_Crafts> craftlst = m_client.getProductCraft(m_pid); gccraft.DataSource = craftlst; } base.FormLoad(); }