public ModifyPosAddressResponse ModifyPosAddress(ModifyPosAddressRequest request) { ModifyPosAddressResponse response = new ModifyPosAddressResponse(); PosAddress posAddress = _posAddressRepository .FindBy(request.AddressId); posAddress.Id = request.AddressId; posAddress.Address = request.Address; posAddress.PosMerchants = request.PosMerchants.ConvertToPosMerchants(); if (posAddress.GetBrokenRules().Count() > 0) { response.Errors = posAddress.GetBrokenRules().ToList(); } else { try { _posAddressRepository.Save(posAddress); _uow.Commit(); response.Errors = new List <BusinessRule>(); } catch (Exception ex) { response.Errors = new List <BusinessRule>(); response.Errors.Add(new BusinessRule("DAL", "DAL_ERROR: " + ex.Message)); } } return(response); }
public JsonResult Update(PosAddressDetailView vm) { GetPosAddressRequest request = new GetPosAddressRequest(); request.AddressId = vm.AddressId; ModifyPosAddressRequest updateRequest = _posAddressService.GetPosAddress(request).PosAddress.ConvertToModifyPosAddressRequest(); updateRequest.AddressId = vm.AddressId; updateRequest.Address = vm.Address; ModifyPosAddressResponse response = _posAddressService.ModifyPosAddress(updateRequest); return(Json(response)); }