Beispiel #1
0
        public void AddDeliveryAddress(DeliveryAddressDTO model)
        {
            var da = DeliveryAddressFactory.CreateInstance(model.UserId, model.LinkMan, model.Gender, model.Mobile, model.Mark, model.IsDefault, model.Province, model.City, model.Area, model.StreetAddress, model.Postcode, model.CreatedBy);

            _deliveryAddressRepository.Add(da);
            _dbUnitOfWork.Commit();
        }
Beispiel #2
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());
        }