public ActionResult <Partner> RegisterPartner([FromBody] Partner partner)
        {
            if (PartnerValidator.IsUsernameExists(partner))
            {
                return(BadRequest(ErrorHandler.GenerateError(999, "Username already exists.")));
            }

            _partnerRepo.Create(partner);

            return(partner);
        }
Ejemplo n.º 2
0
 private void SaveBtn_Click(object sender, RoutedEventArgs e)
 {
     selectedPartner.Address            = AddressBox.Text;
     selectedPartner.Taxnumber          = PartnerTaxNumberBox.Text;
     selectedPartner.BankAccountNumber  = PartnerAccountNumberBox.Text;
     selectedPartner.ContactName        = PartnerContactNameBox.Text;
     selectedPartner.ContactPhoneNumber = PartnerContactPhoneBox.Text;
     selectedPartner.ContactPosition    = PartnerContactPositionBox.Text;
     selectedPartner.Other = PartnerOtherBox.Text;
     if (!PartnerValidator.ValidatePartner(selectedPartner))
     {
         return;
     }
     PartnerHandler.SavePartner(selectedPartner, true);
     MessageBox.Show("Sikeres mentés!", "Mentve", MessageBoxButton.OK, MessageBoxImage.Information);
     this.Close();
 }
Ejemplo n.º 3
0
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            Partner partner = new Partner(PartnerNameBox.Text, AddressBox.Text, PartnerTaxNumberBox.Text, PartnerAccountNumberBox.Text, PartnerContactNameBox.Text, PartnerContactPositionBox.Text, PartnerContactPhoneBox.Text, PartnerOtherBox.Text);
            bool    valid   = PartnerValidator.ValidatePartner(partner);

            if (valid)
            {
                if (!PartnerHandler.SearchForPartner(partner))
                {
                    PartnerHandler.CreateDirectoryForPartner(partner);
                    PartnerHandler.SavePartner(partner, false);
                    MessageBox.Show("Sikeres mentés", "Kész", MessageBoxButton.OK, MessageBoxImage.Information);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Már létezik ilyen névvel partnercég", "Hiba", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }