示例#1
0
        //TODO Nadpisz adres
        public void AddAddress()
        {
            AddressManager manager = new AddressManager();
            Address        add     = new Address("test", 1234, Street, City, PostalCode);

            AddressModel = add;
            manager.Create(add);
        }
        private async void InsertAddress_OnClick(object sender, RoutedEventArgs e)
        {
            var selectedPerson = ContactsList.SelectedItem as Person;

            if (selectedPerson != null)
            {
                var a = await _addressManager.Create(new Address(Address.Text, selectedPerson.Id));

                AddressList.Items.Add(a);
            }
        }
        // POST
        // CREATE
        public IHttpActionResult Post(Address address)
        {
            try
            {
                var mng = new AddressManager();
                mng.Create(address);

                apiResp         = new ApiResponse();
                apiResp.Message = "Action was executed.";

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
        }
示例#4
0
 public ActionResult <AddressDTO> Create([FromBody] AddressCreateDTO userInput)
 {
     try { return(_addressManager.Create(userInput)); }
     catch (BaseCustomException ex) { return(BadRequest(ex.Message)); }
 }