public async Task <CardDto> Register(CardCredentialsDto cardCredentials) { (string number, string pin, int userId) = cardCredentials; Card card = new() { Number = number, Pin = BC.HashPassword(pin), UserId = userId, CheckingBranch = new CheckingBranch { Balance = 0m }, User = await Context.Users.FindAsync(cardCredentials.UserId) }; await Context.AddAsync(card); await Context.SaveChangesAsync(); return(Mapper.Map <CardDto>(card)); }
public async Task <CardDto> Register([FromBody] CardCredentialsDto cardCredentials) { return(await _cardService.Register(cardCredentials)); }