Beispiel #1
0
        public CreatePosAddressResponse CreatePosAddress(CreatePosAddressRequest request)
        {
            CreatePosAddressResponse response = new CreatePosAddressResponse();
            PosAddress posAddress             = new PosAddress();

            posAddress.Address      = request.Address;
            posAddress.PosMerchants = request.PosMerchants.ConvertToPosMerchants();

            if (posAddress.GetBrokenRules().Count() > 0)
            {
                response.Errors = posAddress.GetBrokenRules().ToList();
            }
            else
            {
                try {
                    _posAddressRepository.Add(posAddress);
                    _uow.Commit();
                    response.Errors = new List <BusinessRule>();
                } catch (Exception ex)
                {
                    List <BusinessRule> errors = new List <BusinessRule>();
                    do
                    {
                        errors.Add(new BusinessRule("DAL", "DAL_ERROR: " + ex.Message));
                        ex = ex.InnerException;
                    } while (ex != null);

                    response.Errors = errors;
                }
            }

            return(response);
        }
        public JsonResult Create(PosAddressDetailView vm)
        {
            CreatePosAddressRequest request = new CreatePosAddressRequest();

            request.Address = vm.Address;
            CreatePosAddressResponse response = _posAddressService.CreatePosAddress(request);

            return(Json(response));
        }