Exemplo n.º 1
0
        public async Task AgregarEditarRolAsync(RolInput rol)
        {
            if (rol.Codigo.GetValueOrDefault(0) > 0)
            {
                Rol rol1 = await _rolRepository.GetRolById(rol.Codigo.Value, trackear : true);

                _mapper.Map <RolInput, Rol>(rol, rol1);
            }
            else
            {
                Rol rol1 = _mapper.Map <Rol>(rol);
                await _rolRepository.AgregarEditarRolAsync(rol1);
            }
            await _rolRepository.SaveChangesAsync();
        }