Example #1
0
        public ActionResult Post([FromBody] DeliveryAddress deliveryAddress)
        {
            try
            {
                //Validation for DeliveryAdress
                deliveryAddress.Validate();
                if (!deliveryAddress.IsValid)
                {
                    return(BadRequest(deliveryAddress.GetMessageValidation()));
                }

                _deliveryAddressRepository.Add(deliveryAddress);
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.ToString()));
            }

            return(Ok());
        }