public int Post(SupplierViewModel supplier) { try { service.CreateSupplier(supplier); return(1); } catch (Exception) { return(0); } }
void OnSaveSupplier(object param) { Mouse.OverrideCursor = Cursors.Wait; SupplierDetailEntity supplier = new SupplierDetailEntity(); supplier.ID = this.SelectedSearchSupplier; supplier.SupplierName = this.SupplierName; supplier.Email = this.Email; supplier.Fax = this.Fax; supplier.Telephone = this.Telephone; supplier.Supp_Reg_No = this.Supp_Reg_No; supplier.Sup_Bill_to_city = this.Sup_Bill_to_city; supplier.Sup_Bill_to_country = this.Sup_Bill_to_country; supplier.Sup_Bill_to_line1 = this.Sup_Bill_to_line1; supplier.Sup_Bill_to_line2 = this.Sup_Bill_to_line2; supplier.Sup_Bill_to_post_code = this.Sup_Bill_to_post_code; supplier.Sup_Bill_to_state = this.Sup_Bill_to_state; supplier.ShipAddressLine1 = this.ShipAddressLine1; supplier.ShipAddressLine2 = this.ShipAddressLine2; supplier.ShipCity = this.ShipCity; supplier.ShipCountry = this.ShipCountry; supplier.ShipState = this.ShipState; supplier.ShipPostalCode = this.ShipPostalCode; supplier.ContactPerson = this.ContactPerson; supplier.GstRegistrationNo = this.GstRegistrationNo; supplier.Remarks = this.Remarks; supplier.IsInActive = this.IsInActive; supplier.ChangeSupplierGST = this.ChangeSupplierGST; supplier.Balance = this.Balance; supplier.ID = this.ID; supplier.CreditLimitAmount = this.CreditLimitAmount; supplier.CreditLimitDays = this.CreditLimitDays; supplier.TaxId = this.SelectedTaxId; MessageBoxResult result = MessageBox.Show("Do you want to save changes?", "Save Content", MessageBoxButton.YesNo); switch (result) { case MessageBoxResult.Yes: ISupplierRepository supplierRepository = new SupplierRepository(); var savesupplier = supplierRepository.CreateSupplier(supplier); if (savesupplier) { if (this.ID == 0) { //this.SearchSupplier = supplierRepository.GetAllSupplier().ToList(); //var SupplierIdSelected = this.SearchSupplier[this.SearchSupplier.Count - 1].ID; //this.SelectedSearchSupplier = SupplierIdSelected; RefreshData(); } else { this.TotalSupplier = supplierRepository.GetAllSupplier().Count(); this.InActiveSupplier = supplierRepository.GetSupplierCount("Y"); this.ActiveSupplier = TotalSupplier - InActiveSupplier; } } else { MessageBox.Show("There was some problem while updating the values, Kindly try again later."); } break; case MessageBoxResult.No: break; } //if (supplier.ChangeSupplierGST == true) //{ // this.ChangeSupplierGSTTrue = supplier.ChangeSupplierGST; // this.ChangeSupplierGSTFalse = false; //} //else //{ // this.ChangeSupplierGSTTrue = false; // this.ChangeSupplierGSTFalse = true; //} Mouse.OverrideCursor = null; }