public object Post(CreditCardRequest request) { var session = this.GetSession(); var command = new AddOrUpdateCreditCard { AccountId = new Guid(session.UserAuthId) }; Mapper.Map(request, command); _commandBus.Send(command); return(new HttpResult(HttpStatusCode.OK)); }
public void Handle(AddOrUpdateCreditCard command) { var account = _repository.Find(command.AccountId); account.AddOrUpdateCreditCard( command.CreditCardCompany, command.CreditCardId, command.NameOnCard, command.Last4Digits, command.ExpirationMonth, command.ExpirationYear, command.Token, command.Label, command.ZipCode, command.StreetNumber, command.StreetName, command.Email, command.Phone, command.Country); _repository.Save(account, command.Id.ToString()); }