public Task <bool> CalcularReciboEmpleado(ReciboEmpleadoToCreateVM reciboEmpleadoToCreateVM) { var totalBruto = (reciboEmpleadoToCreateVM.ValorHora * reciboEmpleadoToCreateVM.HorasTrabajadas) + (reciboEmpleadoToCreateVM.Antiguedad * 30); var totalDescuento = (totalBruto * 0.13m); var totalNeto = totalBruto - totalDescuento; ReciboEmpleadoEntity entity = new ReciboEmpleadoEntity(); entity.Antiguedad = reciboEmpleadoToCreateVM.Antiguedad; entity.Nombre = reciboEmpleadoToCreateVM.Nombre; entity.TotalBruto = totalBruto; entity.TotalDescuento = totalDescuento; entity.ValorNeto = totalNeto; return(_empleadoRepository.RegistrarReciboEmpleado(entity)); }
public async Task <bool> RegistrarReciboEmpleado(ReciboEmpleadoEntity reciboEmpleadoEntity) { if (_dbConnection.State == ConnectionState.Closed) { _dbConnection.Open(); } var result = await _dbConnection.QueryAsync <int>("RegistrarReciboEmpleado", new { reciboEmpleadoEntity.Nombre, reciboEmpleadoEntity.ValorHora, reciboEmpleadoEntity.ValorNeto, reciboEmpleadoEntity.TotalBruto, reciboEmpleadoEntity.TotalDescuento }, commandType : CommandType.StoredProcedure); return(result.FirstOrDefault() > default(int)); }