public IActionResult Addresses(int id) { try { var address = _addressFactory.Get(id); return(Ok(address)); } catch (Exception) { return(BadRequest()); } }
private void Subscribe_Btn(object sender, RoutedEventArgs e) { if (AreUserFieldsOk()) { string login = Login_TxtBox.Text; string password = Password_Box.Password; DateTime birthday = (DateTime)Birthday_DatePicker.SelectedDate; short streetNumber = Convert.ToInt16(StreetNumber_TxtBox.Text); string streetName = StreetName_TxtBox.Text; string cityName = CityName_TxtBox.Text; string postalCode = PostalCode_TxtBox.Text; Region region = (Region)Region_cmbBox.SelectedItem; City city = CityFactory.Get(cityName, postalCode, region); Address address = AddressFactory.Get(streetNumber, streetName, city); string encryptedPassword = Password.Encrypt(password.ToString()); if (!User.IsInDb(login, encryptedPassword)) { User user = UserFactory.Create(login, encryptedPassword, birthday, address); DialogBox.Ok("Success", "User has been correctly recorded"); ResetInscription(); } else { DialogBox.Ok("Error", "Check fields"); } } else { DialogBox.Ok("Error", "Check fields"); } }
public address GetDireccion(int id) { address address = new address(); try { address = addressFactory.Get(id); return(address); } catch (System.Exception ex) { throw ex; } }
public IActionResult Address(int id) { var address = _adressfactory.Get(id); return(Ok(address)); }