protected void btnSave_Click(object sender, EventArgs e) { CustomerPartnerDTO customerPartner = new CustomerPartnerDTO(); customerPartner.Cust_Partner_FatherName = txtPatnerFatherName.Text.Trim(); customerPartner.Cust_Partner_Name = txtPatnerName.Text.Trim(); customerPartner.Cust_Partner_CustId = Convert.ToInt32(ViewState[Globals.StateMgmtVariables.CUSTOMERID]); ESalesUnityContainer.Container.Resolve<ICustomerService>().SaveAndUpdateCustomerPatner(customerPartner); BindList(); ResetFields(); }
public int SaveAndUpdateCustomerPatner(CustomerPartnerDTO customerPartner) { customerpartner customerpartnerEntity = new customerpartner(); AutoMapper.Mapper.Map(customerPartner, customerpartnerEntity); if (customerpartnerEntity.Cust_Partner_ID > 0) { ESalesUnityContainer.Container.Resolve<IGenericRepository<customerpartner>>().Update(customerpartnerEntity); } else { //Save agent details ESalesUnityContainer.Container.Resolve<IGenericRepository<customerpartner>>().Save(customerpartnerEntity); } return customerpartnerEntity.Cust_Partner_ID; }