public override BankAccount Map(BankAccountDTO source) { BankAccount newentity = _factory.Construct(); CopyTo(source, newentity); return(newentity); }
//Do we need an event-based system? (so //BankAccountLogic can be told to create an //account, when a new customer is made, //without circular references) public BankAccountDTO CreateAccount(Guid owner) { var customer = _customerLogic.ViewCustomer(owner); if (customer == null) { return(null); } //designchoice: construct new content in an Entity //and trigger insert; var newaccount = _bankAccountFactory.Construct(); newaccount.Iban = "NL59AFCA6611003322"; newaccount.Worth = 0; newaccount.OwnerId = customer.Id; _repository.Insert(newaccount); _repository.SaveChanges(); return(_dtoMapper.Map(newaccount)); }