예제 #1
0
        public async Task <ServiceResponse <List <GetCuentaDto> > > AddCuenta(AddCuentaDto newCuenta)
        {
            ServiceResponse <List <GetCuentaDto> > serviceResponse = new ServiceResponse <List <GetCuentaDto> >();
            Cuenta cuenta = _mapper.Map <Cuenta>(newCuenta);

            await _context.Cuentas.AddAsync(cuenta);

            await _context.SaveChangesAsync();

            serviceResponse.Data = (_context.Cuentas.Select(c => _mapper.Map <GetCuentaDto>(c))).ToList();
            return(serviceResponse);
        }
예제 #2
0
 public async Task <IActionResult> AddCuenta(AddCuentaDto newCuenta)
 {
     return(Ok(await _cuentaService.AddCuenta(newCuenta)));
 }